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

--- Comment #4 from Sebastian Pop <spop at gcc dot gnu.org> 2011-02-18 18:28:13 
UTC ---
http://gcc.gnu.org/viewcvs?view=revision&revision=168211
removed all the uses of int_cst_value and replaced them with
tree_int_to_gmp, and here is what happens:

Breakpoint 5, scan_tree_for_params_right_scev (s=0x190a300, e=0x7ffff7ec96b8,
var=1, expr=0x190cb20) at ../../gcc/graphite-sese-to-poly.c:637
(gdb) p e
$1 = (tree) 0x7ffff7ec96b8
(gdb) pgs
4294967295

(gdb) p int_cst_value (e)
$2 = -1
(gdb) p e
$3 = (tree) 0x7ffff7ec96b8
(gdb) pt
 <integer_cst 0x7ffff7ec96b8 type <integer_type 0x7ffff7edc540 unsigned int>
constant 4294967295>

The reason int_cst_value returns -1 is that it sign extends the value:

  unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x);
      bool negative = ((val >> (bits - 1)) & 1) != 0;
      if (negative)
    val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1;

Reply via email to