This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/47383] ivopts miscompiles Pmode != ptr_mode
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 21 Jan 2011 05:33:57 +0000
- Subject: [Bug middle-end/47383] ivopts miscompiles Pmode != ptr_mode
- Auto-submitted: auto-generated
- References: <bug-47383-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47383
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-21 05:33:53 UTC ---
(In reply to comment #3)
> The ivopts pass transforms
>
>
> unsigned int D.2715;
> unsigned int D.2716;
> ...
> D.2715_43 = (unsigned int) elems_3(D);
> D.2716_42 = D.2715_43 + 4294967295;
> n_49 = (int) D.2716_42;
>
> leads o the wrong result when Pmode != unsigned int. Adding
> -fno-ivopts fixes the bug.
>
This is OK due to cast to int. But
long unsigned int D.2757;
long unsigned int D.2749;
long unsigned int D.2750;
unsigned int ivtmp.20;
int D.2748;
unsigned int ivtmp.17;
...
D.2749_6 = (long unsigned int) prephitmp.8_18;
D.2750_34 = ivtmp.17_28 - D.2749_6;
MEM[symbol: heap, index: D.2750_34, step: 8, offset: 2296B] = n_11;
looks wrong since it assumes D.2750_34 can be negative. But
D.2750_34 is unsigned. It won't work when ptr_mode == unsigned
and Pmode is unsigned long long.