[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #4 from Richard Biener rguenth at gcc dot gnu.org --- I will have a looksee.
[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662 --- Comment #5 from Richard Biener rguenth at gcc dot gnu.org --- It looks like changing the testcase line d = foo (a == 0, (0, 35536)); to d = foo (a == 0, -3); fixes it. _No_ IL difference in 065t.mergephi2, but then 066t.vrp1 has main () { char e; @@ -39,6 +35,7 @@ _Bool _4; int _5; int _7; + int c.4_9; int b.5_11; int _12; @@ -46,22 +43,37 @@ a.0_3 = a; _4 = a.0_3 == 0; _5 = (int) _4; - _12 = 0; - d = 0; - _7 = 0; - e_8 = 0; - iftmp.3_1 = 0; - b ={v} 0; - b.5_11 ={v} b; - if (b.5_11 != 0) + _12 = _5 / -3; + d = _12; + _7 = _12 % 14; + e_8 = (char) _7; + if (_7 != 0) goto bb 3; else goto bb 4; bb 3: - abort (); + c.4_9 = c; + if (c.4_9 != 0) +goto bb 5; + else +goto bb 4; bb 4: + + bb 5: + # iftmp.3_1 = PHI 1(3), 0(4) + b ={v} iftmp.3_1; + b.5_11 ={v} b; + if (b.5_11 != 0) +goto bb 6; + else +goto bb 7; + + bb 6: + abort (); + + bb 7: return 0; } what?! Reduced testcase: extern void abort (void); int a, c, d; volatile int b; static int foo (int p1, short p2) { return p1 / p2; } int main () { char e; d = foo (a == 0, (0, 35536)); e = d % 14; b = e c; if (b != 0) abort (); return 0; }
[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2013-10-08 CC||mpolacek at gcc dot gnu.org Target Milestone|--- |4.9.0 Ever confirmed|0 |1 --- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org --- Confirmed. It seems to be the VRP; adding -fno-tree-vrp makes trunk behave as 4.8.
[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org --- Started with r202944.
[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662 --- Comment #3 from Marek Polacek mpolacek at gcc dot gnu.org --- Actually, I think it's the uncprop: --- Q.c.139t.crited22013-10-08 13:03:04.169955615 +0200 +++ Q.c.141t.uncprop12013-10-08 13:03:04.169955615 +0200 @@ -51,7 +51,7 @@ _13 = (int) _8; bb 4: - # iftmp.3_1 = PHI 0(5), _13(3) + # iftmp.3_1 = PHI _7(5), _13(3) b = iftmp.3_1; printf (%d\n, iftmp.3_1); return 0; so -fno-tree-dominator-opts makes the bug go away.