------- Comment #5 from rguenth at gcc dot gnu dot org 2008-01-13 17:00 ------- We enter that function with:
{4294967288B, +, 4}_1 <polynomial_chrec 0x2acbda7bd500 type <pointer_type 0x2acbd9dd09c0 type <integer_type 0x2acbd9dc1540 int sizes-gimplified public SI size <integer_cst 0x2acbd9db1ab0 constant invariant 32> unit size <integer_cst 0x2acbd9db1720 constant invariant 4> align 32 symtab 0 alias set 2 canonical type 0x2acbd9dc1540 precision 32 min <integer_cst 0x2acbd9db1a20 -2147483648> max <integer_cst 0x2acbd9db1a50 2147483647> pointer_to_this <pointer_type 0x2acbd9dd09c0>> sizes-gimplified public unsigned SI size <integer_cst 0x2acbd9db1ab0 32> unit size <integer_cst 0x2acbd9db1720 4> align 32 symtab 0 alias set -1 canonical type 0x2acbd9dd09c0> arg 0 <integer_cst 0x2acbd9dce510 type <integer_type 0x2acbd9dc1540 int> constant invariant 1> arg 1 <integer_cst 0x2acbda7bf4b0 type <pointer_type 0x2acbd9dd09c0> constant invariant public overflow 4294967288> arg 2 <integer_cst 0x2acbd9db1720 4>> where the HOST_WIDE_INT will be positive (it's not sign-extended). For -m64 we instead get {-8B, +, 4}_1 <polynomial_chrec 0x2b154a2925f0 type <pointer_type 0x2b15498a3b40 type <integer_type 0x2b1549894540 int sizes-gimplified public SI size <integer_cst 0x2b1549884ab0 constant invariant 32> unit size <integer_cst 0x2b1549884720 constant invariant 4> align 32 symtab 0 alias set 2 canonical type 0x2b1549894540 precision 32 min <integer_cst 0x2b1549884a20 -2147483648> max <integer_cst 0x2b1549884a50 2147483647> pointer_to_this <pointer_type 0x2b15498a3b40>> sizes-gimplified public unsigned DI size <integer_cst 0x2b1549884ba0 constant invariant 64> unit size <integer_cst 0x2b1549884bd0 constant invariant 8> align 64 symtab 0 alias set -1 canonical type 0x2b15498a3b40> arg 0 <integer_cst 0x2b15498a1570 type <integer_type 0x2b1549894540 int> constant invariant 1> arg 1 <integer_cst 0x2b154a2948a0 type <pointer_type 0x2b15498a3b40> constant invariant public overflow 18446744073709551608> arg 2 <integer_cst 0x2b1549884720 4>> where the HOST_WIDE_INT will be negative. For consistency you should always use sizetype variables for offsets, as they are properly sign-extended. Using pointer types asks for trouble. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34769