aboutsummaryrefslogtreecommitdiff
path: root/gcc/genmatch.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-02-28 13:40:41 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-02-28 13:40:41 +0000
commit9348eb677eb9e113ae7889faa5466723a307941f (patch)
treefcffeb99d5674cf27e19b9ce648a6e5782e6b8c0 /gcc/genmatch.c
parent35129fd3a745403bec0a06d62b18fc30ce1bbf8e (diff)
downloadgcc-9348eb677eb9e113ae7889faa5466723a307941f.zip
gcc-9348eb677eb9e113ae7889faa5466723a307941f.tar.gz
gcc-9348eb677eb9e113ae7889faa5466723a307941f.tar.bz2
re PR c/84607 (Side effects discarded in address computation inside 'if')
2018-02-28 Richard Biener <rguenther@suse.de> PR middle-end/84607 * genmatch.c (capture_info::walk_match): Do not mark captured expressions without operands as expr_p given they act more like predicates and should be subject to "lost tail" side-effect preserving. * gcc.dg/pr84607.c: New testcase. From-SVN: r258061
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r--gcc/genmatch.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index e2b2cbf..be6efe3 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2104,7 +2104,11 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg,
if (c->what
&& (e = dyn_cast <expr *> (c->what)))
{
- info[where].expr_p = true;
+ /* Zero-operand expression captures like ADDR_EXPR@0 are
+ similar as predicates -- if they are not mentioned in
+ the result we have to force them to have no side-effects. */
+ if (e->ops.length () != 0)
+ info[where].expr_p = true;
info[where].force_single_use |= e->force_single_use;
}
}