re PR inline-asm/67448 (compiler crash#inline assembly#rvalue operand with constraint...
authorMarek Polacek <polacek@redhat.com>
Mon, 7 Sep 2015 09:19:13 +0000 (09:19 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 7 Sep 2015 09:19:13 +0000 (09:19 +0000)
PR inline-asm/67448
* gimplify.c (gimplify_asm_expr): Don't allow MODIFY_EXPR as
a memory input.

* gcc.dg/asm-10.c: New test.

From-SVN: r227517

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asm-10.c [new file with mode: 0644]

index e64180a6c4c5d22a1a9246dd43c4191a87eec3e1..d5f9f785393f3c6f29cda10008d15f12942273e2 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-07  Marek Polacek  <polacek@redhat.com>
+
+       PR inline-asm/67448
+       * gimplify.c (gimplify_asm_expr): Don't allow MODIFY_EXPR as
+       a memory input.
+
 2015-09-07  Marek Polacek  <polacek@redhat.com>
 
        * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning.
index c8f271884188b9da5c337dc80e6916d1adf67931..b7a918baa5665f8ba4f8c07c0ed430428f254046 100644 (file)
@@ -5210,7 +5210,8 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
          if (TREE_CODE (inputv) == PREDECREMENT_EXPR
              || TREE_CODE (inputv) == PREINCREMENT_EXPR
              || TREE_CODE (inputv) == POSTDECREMENT_EXPR
-             || TREE_CODE (inputv) == POSTINCREMENT_EXPR)
+             || TREE_CODE (inputv) == POSTINCREMENT_EXPR
+             || TREE_CODE (inputv) == MODIFY_EXPR)
            TREE_VALUE (link) = error_mark_node;
          tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
                                is_gimple_lvalue, fb_lvalue | fb_mayfail);
index fdec96598311eeeeb00d14d33b20909755505fa2..5fece2fc090c43a1de55c030352189e5a5960949 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-07  Marek Polacek  <polacek@redhat.com>
+
+       PR inline-asm/67448
+       * gcc.dg/asm-10.c: New test.
+
 2015-09-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/67452
diff --git a/gcc/testsuite/gcc.dg/asm-10.c b/gcc/testsuite/gcc.dg/asm-10.c
new file mode 100644 (file)
index 0000000..e6c03c6
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR inline-asm/67448 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+f (int i)
+{
+  asm ("" : : "m"(i += 1)); /* { dg-error "not directly addressable" } */
+  asm ("" : : "m"(i++)); /* { dg-error "not directly addressable" } */
+  asm ("" : : "m"(++i)); /* { dg-error "not directly addressable" } */
+  asm ("" : : "m"(i = 0)); /* { dg-error "not directly addressable" } */
+}