re PR c/21419 (Accepts writting to const via asm)
gcc: 2005-09-29 Paolo Bonzini <bonzini@gnu.org> PR c/21419 * gimplify.c (gimplify_asm_expr): Raise an error if an output is read-only. testsuite: 2005-09-29 Paolo Bonzini <bonzini@gnu.org> PR c/21419 * gcc.dg/pr21419.c: New test. From-SVN: r104774
This commit is contained in:
parent
090037799c
commit
02eb875fcf
@ -1,3 +1,9 @@
|
||||
2005-09-29 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
PR c/21419
|
||||
* gimplify.c (gimplify_asm_expr): Raise an error if an output is
|
||||
read-only.
|
||||
|
||||
2005-09-29 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
PR tree-optimization/23911
|
||||
|
@ -3544,6 +3544,12 @@ gimplify_asm_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
||||
parse_output_constraint (&constraint, i, 0, 0,
|
||||
&allows_mem, &allows_reg, &is_inout);
|
||||
|
||||
if (TYPE_READONLY (TREE_TYPE (TREE_VALUE (link))))
|
||||
{
|
||||
error ("invalid lvalue in asm output %d", i);
|
||||
ret = GS_ERROR;
|
||||
}
|
||||
|
||||
if (!allows_reg && allows_mem)
|
||||
lang_hooks.mark_addressable (TREE_VALUE (link));
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2005-09-29 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
PR c/21419
|
||||
* gcc.dg/pr21419.c: New test.
|
||||
|
||||
2005-09-29 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
* gcc.dg/pr23911.c: New test.
|
||||
|
15
gcc/testsuite/gcc.dg/pr21419.c
Normal file
15
gcc/testsuite/gcc.dg/pr21419.c
Normal file
@ -0,0 +1,15 @@
|
||||
/* { dg-do compile } */
|
||||
const int i = 0;
|
||||
|
||||
void f(void)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "=m" (i)); /* { dg-error "invalid lvalue in asm output" } */
|
||||
|
||||
}
|
||||
|
||||
void g(const int set)
|
||||
{
|
||||
__asm__ __volatile__ ("" : "=r" (set)); /* { dg-error "invalid lvalue in asm output" } */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user