Commit 9348eb67 by Richard Biener Committed by Richard Biener

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
parent 35129fd3
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.
2018-02-28 Alexandre Oliva <aoliva@redhat.com> 2018-02-28 Alexandre Oliva <aoliva@redhat.com>
PR rtl-optimization/81611 PR rtl-optimization/81611
......
...@@ -2104,7 +2104,11 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg, ...@@ -2104,7 +2104,11 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg,
if (c->what if (c->what
&& (e = dyn_cast <expr *> (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; info[where].force_single_use |= e->force_single_use;
} }
} }
......
2018-02-28 Richard Biener <rguenther@suse.de>
PR middle-end/84607
* gcc.dg/pr84607.c: New testcase.
2018-02-28 Nathan Sidwell <nathan@acm.org> 2018-02-28 Nathan Sidwell <nathan@acm.org>
PR c++/84602 PR c++/84602
......
/* { dg-do run } */
extern void exit(int);
extern void abort(void);
int a[10];
int foo()
{
exit (0);
return 0;
}
int main()
{
if (&a[foo()])
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment