[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug tree-optimization/31169] Bootstrap comparison error at revision 122821




------- Comment #37 from rguenth at gcc dot gnu dot org  2007-03-30 10:01 -------
The (target) difference seems to be that I get (on x86_64)

  mask_lo_45 = 0x0ffffffffffffffff >> D.33492_44;

with a value range of [0,64] for D.33492_44 and a resulting value range of
[0, +INF] for mask_lo_45, not [+INF, +INF] (which is wrong).

Note that I get the same correct behavior iff changing HWI to 32/64bits and
using -m32.  This is the testcase I'm looking at:

#define HOST_WIDE_INT long
#define HOST_BITS_PER_WIDE_INT (8*8)

int
sign_bit_p (int width, HOST_WIDE_INT val_hi, unsigned HOST_WIDE_INT val_lo)
{
  unsigned HOST_WIDE_INT mask_lo, lo;
  HOST_WIDE_INT mask_hi, hi;

  if (width > HOST_BITS_PER_WIDE_INT)
    {
      hi = (unsigned HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT - 1);
      lo = 0;

      mask_hi = ((unsigned HOST_WIDE_INT) -1
                 >> (2 * HOST_BITS_PER_WIDE_INT - width));
      mask_lo = -1;
    }
  else
    {
      hi = 0;
      lo = (unsigned HOST_WIDE_INT) 1 << (width - 1);

      mask_hi = 0;
      mask_lo = ((unsigned HOST_WIDE_INT) -1
                 >> (HOST_BITS_PER_WIDE_INT - width));
    }

  if ((val_hi & mask_hi) == hi
      && (val_lo & mask_lo) == lo)
    return 1;

  return 0;
}

can you confirm that this one is miscompiled?  I'll try to build a cross
compiler now.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



Reply to: