]> git.pld-linux.org Git - packages/gcc.git/blob - gcc-pr21419.patch
- reject writting to const via asm.
[packages/gcc.git] / gcc-pr21419.patch
1 This fixes PR21419 by checking that read-only expressions are not given 
2 as outputs for an asm statement.  The gimplifier was already performed 
3 consistency tests on asm statements, so this looked like a good place to 
4 make this check.
5
6 --- gcc/gcc/gimplify.c  14 Sep 2005 06:59:10 -0000
7 +++ gcc/gcc/gimplify.c  25 Sep 2005 12:32:41 -0000
8 @@ -3543,6 +3543,12 @@ gimplify_asm_expr (tree *expr_p, tree *p
9        parse_output_constraint (&constraint, i, 0, 0,
10                                &allows_mem, &allows_reg, &is_inout);
11  
12 +      if (TYPE_READONLY (TREE_TYPE (TREE_VALUE (link))))
13 +       {
14 +         error ("invalid lvalue in asm output %d", i);
15 +         ret = GS_ERROR;
16 +       }
17 +
18        if (!allows_reg && allows_mem)
19         lang_hooks.mark_addressable (TREE_VALUE (link));
20  
This page took 0.023877 seconds and 3 git commands to generate.