------- Comment #6 from rguenth at gcc dot gnu dot org  2008-04-23 14:32 -------
-fno-tree-vrp "fixes" it, but

D.2830_35: [0, 65535]
D.2839_49: [0, 65535]
D.2840_56: [0, +INF(OVF)]

  D.2829_34 = *D.2828_33;
  D.2830_35 = (int) D.2829_34;
...
  D.2838_48 = *D.2837_47; 
  D.2839_49 = (int) D.2838_48;
  D.2840_56 = D.2830_35 * D.2839_49;
  high_59 = D.2840_56 < 0;

looks suspiciously like a case of signed integer overflow undefinedness.

                        uv = x[1 + j] * x[1 + i];
                        high = (uv & 0x80000000) != 0;

the multiplication will be carried out in signed int because VBigDig, the
type of *x, unsigned short, promotes to int.  Thus the above is equivalent to

                       uv = (unsigned int)((int)x[1 + j] * (int)x[1 + i]);
                       high = (uv & 0x80000000) != 0;

at which the compiler can conclude that the result of the multiplication
is never negative.  Fix this by doing

                        uv = (VBigDigs)x[1 + j] * (VBigDigs)x[1 + i];
                        high = (uv & 0x80000000) != 0;

instead.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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

Reply via email to