This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/58662] [4.9 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 Oct 2013 14:00:30 +0000
- Subject: [Bug rtl-optimization/58662] [4.9 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
- Auto-submitted: auto-generated
- References: <bug-58662-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> 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?!
That's because there _is_ a IL difference. With (0, 35536) the
-30000 tree constant has TREE_OVERFLOW set while with literal
-30000 in the source it does not.
Due to VRP relying on some fold-const.c overflow detection with
TREE_OVERFLOW this effect is to be expected.
[but in reality GIMPLE should not have any TREE_OVERFLOW constants
in the IL, though that's hard to avoid]