[Bug tree-optimization/58662] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 10 13:30:00 GMT 2013
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, -30000);
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 / -30000;
+ 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;
}
More information about the Gcc-bugs
mailing list