This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/47383] ivopts miscompiles Pmode != ptr_mode


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&amp;T
On Jan 20, 2011 21:34, hjl.tools at gmail dot com
&lt;gcc-bugzilla@gcc.gnu.org&gt; wrote: 

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47383



--- Comment #4 from H.J. Lu &lt;hjl.tools at gmail dot com&gt; 2011-01-21
05:33:53 UTC ---

(In reply to comment #3)

&gt; The ivopts pass transforms

&gt; 

&gt; 

&gt;   unsigned int D.2715;

&gt;   unsigned int D.2716;

&gt; ...

&gt;   D.2715_43 = (unsigned int) elems_3(D);

&gt;   D.2716_42 = D.2715_43 + 4294967295;

&gt;   n_49 = (int) D.2716_42;

&gt; 

&gt; leads o the wrong result when Pmode != unsigned int. Adding

&gt; -fno-ivopts fixes the bug.

&gt; 



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]