From 8f1e28e0ff4a93f1416f62c6f82ed62174a02e7d Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 7 Sep 2015 09:19:13 +0000 Subject: [PATCH] re PR inline-asm/67448 (compiler crash#inline assembly#rvalue operand with constraint "m") 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 | 6 ++++++ gcc/gimplify.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asm-10.c | 12 ++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/asm-10.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e64180a6c4c..d5f9f785393 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-09-07 Marek Polacek + + PR inline-asm/67448 + * gimplify.c (gimplify_asm_expr): Don't allow MODIFY_EXPR as + a memory input. + 2015-09-07 Marek Polacek * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c8f27188418..b7a918baa56 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fdec9659831..5fece2fc090 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-07 Marek Polacek + + PR inline-asm/67448 + * gcc.dg/asm-10.c: New test. + 2015-09-04 Jakub Jelinek 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 index 00000000000..e6c03c62cab --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-10.c @@ -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" } */ +} -- 2.30.2