[Bug middle-end/47383] ivopts miscompiles Pmode != ptr_mode
pinskia at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 21 11:54:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47383
--- Comment #6 from pinskia at gmail dot com <pinskia at gmail dot com> 2011-01-21 11:43:45 UTC ---
Sent from my Palm Pre on AT&T
On Jan 20, 2011 21:34, hjl.tools at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
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;
Mem here should have been rejected.
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.
More information about the Gcc-bugs
mailing list