* [PATCH] Don't ICE on invalid asm memory input (PR inline-asm/67448)
@ 2015-09-04 14:51 Marek Polacek
2015-09-04 20:33 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2015-09-04 14:51 UTC (permalink / raw)
To: GCC Patches
In this PR, we were crashing on an invalid asm. I think let's just reject
MODIFY_EXPRs as memory inputs - I'll wager those aren't meant to be supported
anyway.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2015-09-04 Marek Polacek <polacek@redhat.com>
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.
diff --git gcc/gimplify.c gcc/gimplify.c
index c8f2718..b7a918b 100644
--- gcc/gimplify.c
+++ 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 gcc/testsuite/gcc.dg/asm-10.c gcc/testsuite/gcc.dg/asm-10.c
index e69de29..e6c03c6 100644
--- gcc/testsuite/gcc.dg/asm-10.c
+++ 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" } */
+}
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't ICE on invalid asm memory input (PR inline-asm/67448)
2015-09-04 14:51 [PATCH] Don't ICE on invalid asm memory input (PR inline-asm/67448) Marek Polacek
@ 2015-09-04 20:33 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-09-04 20:33 UTC (permalink / raw)
To: Marek Polacek, GCC Patches
On 09/04/2015 08:29 AM, Marek Polacek wrote:
> In this PR, we were crashing on an invalid asm. I think let's just reject
> MODIFY_EXPRs as memory inputs - I'll wager those aren't meant to be supported
> anyway.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2015-09-04 Marek Polacek <polacek@redhat.com>
>
> 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.
OK. Do we need a corresponding doc update too? If so, consider that
pre-approved.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-04 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 14:51 [PATCH] Don't ICE on invalid asm memory input (PR inline-asm/67448) Marek Polacek
2015-09-04 20:33 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).