This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
- From: "zhenqiang.chen at arm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 29 Sep 2014 01:17:23 +0000
- Subject: [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
- Auto-submitted: auto-generated
- References: <bug-63302-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #10 from Zhenqiang Chen <zhenqiang.chen at arm dot com> ---
(In reply to dave.anglin from comment #8)
> On 28-Sep-14, at 10:34 AM, dave.anglin at bell dot net wrote:
>
> > This is what I see on the trunk, but 4.9 is wrong. Possibly, there is
> > a transformation
> > after optimize_range_tests_diff where things go wrong on 4.9.
>
> It seems the difference actually occurs in reassoc1.
>
> 4.9:
>
> <bb 2>:
> x_2 = ival_1(D) & -2147481601;
> _3 = x_2 == 0;
> _8 = x_2 & 2147483647;
> _9 = _8 == 0;
> _4 = x_2 == -2147483648;
> _5 = _9;
> _6 = (int) _5;
> return _6;
This is not optimized by my patch: optimize_range_tests_diff
> trunk:
>
> <bb 2>:
> x_2 = ival_1(D) & -2147481601;
> _3 = x_2 == 0;
> _8 = x_2 + 2147483648;
> _9 = _8 & -2147483649;
> _10 = _9 == 0;
> _4 = x_2 == -2147483648;
> _5 = _10;
> _6 = (int) _5;
> return _6;
This is optimized by the patch. optimize_range_tests_diff is the only change I
added for the patch. Others were just reorganization.
Can you show more detail dumps with -fdump-tree-reassoc1-details?
Thanks!
-Zhenqiang