------- Comment #5 from rguenth at gcc dot gnu dot org 2006-12-31 12:57 ------- It starts as we try to fold
~(grub_scratch_mem.1_5 + 2097152) > 2147483647 from n_of_executions_at_most. The problem is we have here already a type-mismatch: (gdb) call debug_tree (op0) <bit_not_expr 0xb7c20720 type <integer_type 0xb7b9a2e0 unsigned int public unsigned SI size <integer_cst 0xb7b893f0 constant invariant 32> unit size <integer_cst 0xb7b89180 constant invariant 4> align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7b89468 0> max <integer_cst 0xb7b89450 4294967295>> arg 0 <plus_expr 0xb7b909fc type <integer_type 0xb7b9a284 int sizes-gimplified public SI size <integer_cst 0xb7b893f0 32> unit size <integer_cst 0xb7b89180 4> align 32 symtab 0 alias set -1 precision 32 min <integer_cst 0xb7b893a8 -2147483648> max <integer_cst 0xb7b893c0 2147483647> pointer_to_this <pointer_type 0xb7b9ac38>> arg 0 <ssa_name 0xb7c237b0 type <integer_type 0xb7b9a284 int> visited var <var_decl 0xb7b95210 grub_scratch_mem.1> def_stmt <gimple_modify_stmt 0xb7c27438> version 5> arg 1 <integer_cst 0xb7c27348 constant invariant 2097152>>> (unsigned BIT_NOT_EXPR with signed argument.) We get that from scev_probably_wraps_p () at tree extreme = fold_convert (unsigned_type, upper_bound_in_type (type, type)); delta = fold_build2 (MINUS_EXPR, unsigned_type, extreme, base); step_abs = fold_convert (unsigned_type, step); through fold_binary /* Convert -1 - A to ~A. */ if (INTEGRAL_TYPE_P (type) && integer_all_onesp (arg0)) return fold_build1 (BIT_NOT_EXPR, type, arg1); (that needs to read return fold_build1 (BIT_NOT_EXPR, type, op1); at least, which fixes this PR) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30338