This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/69682] New: expression (a && (b==c)) with side effects rewritten to ((b==c) & a)
- From: "mtliang at synopsys dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 05 Feb 2016 02:53:26 +0000
- Subject: [Bug tree-optimization/69682] New: expression (a && (b==c)) with side effects rewritten to ((b==c) & a)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69682
Bug ID: 69682
Summary: expression (a && (b==c)) with side effects rewritten
to ((b==c) & a)
Product: gcc
Version: 5.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: mtliang at synopsys dot com
Target Milestone: ---
Created attachment 37586
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37586&action=edit
test case
The attached test case should print pass in a cases but fails with SIGFPE when
built at -O1 and run with "1" to enable signaling NaNs.
Building with -fdump-tree-all shows that at -O0 the 004t.gimple for { if (same
&& (oldPriority == oldGroup)); } expands into { if (same) if (oldPriority ==
oldGroup); } as expected, but that at -O1 it's already transformed into { if
(oldPriority == oldGroup) & same); } .
At this point, oldPriority holds a signaling NaN but shouldn't be evaluated
because same is false.
With -fverbose-asm, I've gotten the 30+ extra flags that are set between -O0
and -O1 and have tried building the code with -O0 + all flags and with -O1 +
-fno-flags. Neither way seems to make any difference.
By the way, even if the initial tree is generated properly, there is another
known issue where ifcombine will join them together again and that step will
need to be suppressed for testing purposes. See bug 69308 for details.