From 02eb875fcf9775463bd0f7b26d09e6fc41d09893 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Sep 2005 14:53:39 +0000 Subject: re PR c/21419 (Accepts writting to const via asm) gcc: 2005-09-29 Paolo Bonzini PR c/21419 * gimplify.c (gimplify_asm_expr): Raise an error if an output is read-only. testsuite: 2005-09-29 Paolo Bonzini PR c/21419 * gcc.dg/pr21419.c: New test. From-SVN: r104774 --- gcc/gimplify.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 42b8740..e5d50e2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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)); -- cgit v1.1