* [PATCH] Fix part of PR61383
@ 2014-06-02 14:09 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2014-06-02 14:09 UTC (permalink / raw)
To: gcc-patches
In comment #3 it's noted that ifcombine happily hoists possibly
trapping stmts ... oops.
Fixed like the following, bootstrap and regtest running on
x86_64-unknown-linux-gnu.
Richard.
2014-06-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/61383
* tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure
stmts can't trap.
* gcc.dg/torture/pr61383-1.c: New testcase.
Index: gcc/tree-ssa-ifcombine.c
===================================================================
*** gcc/tree-ssa-ifcombine.c (revision 211125)
--- gcc/tree-ssa-ifcombine.c (working copy)
*************** bb_no_side_effects_p (basic_block bb)
*** 128,133 ****
--- 128,134 ----
gimple stmt = gsi_stmt (gsi);
if (gimple_has_side_effects (stmt)
+ || gimple_could_trap_p (stmt)
|| gimple_vuse (stmt))
return false;
}
Index: gcc/testsuite/gcc.dg/torture/pr61383-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr61383-1.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr61383-1.c (working copy)
***************
*** 0 ****
--- 1,35 ----
+ /* { dg-do run } */
+
+ int a, b = 1, c, d, e, f, g;
+
+ int
+ fn1 ()
+ {
+ int h;
+ for (;;)
+ {
+ g = b;
+ g = g ? 0 : 1 % g;
+ e = a + 1;
+ for (; d < 1; d = e)
+ {
+ if (f == 0)
+ h = 0;
+ else
+ h = 1 % f;
+ if (f < 1)
+ c = 0;
+ else if (h)
+ break;
+ }
+ if (b)
+ return 0;
+ }
+ }
+
+ int
+ main ()
+ {
+ fn1 ();
+ return 0;
+ }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-06-02 14:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-02 14:09 [PATCH] Fix part of PR61383 Richard Biener
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).