------- Comment #9 from rguenth at gcc dot gnu dot org 2006-08-20 16:44 ------- Caused by
2006-04-02 Sebastian Pop <[EMAIL PROTECTED]> ... + * tree-chrec.h (build_polynomial_chrec): Insert an assert to check + the types of the operands. ... for the testcase in comment #6 we have the two types type <pointer_type 0xa7cebf18 dw_fde_ref type <record_type 0xa7cebe04 dw_fde_struct sizes-gimplified type_0 SI size <integer_cst 0xa7c5f3f0 constant invariant 32> unit size <integer_cst 0xa7c5f180 constant invariant 4> align 32 symtab 0 alias set 4 fields <field_decl 0xa7cebe60 decl> context <translation_unit_decl 0xa7c77f08 D.1540> pointer_to_this <pointer_type 0xa7cebebc> chain <type_decl 0xa7c77dd0 D.1520>> sizes-gimplified public unsigned SI size <integer_cst 0xa7c5f3f0 32> unit size <integer_cst 0xa7c5f180 4> align 32 symtab 0 alias set -1> and <pointer_type 0xa7cebebc type <record_type 0xa7cebe04 dw_fde_struct sizes-gimplified type_0 SI size <integer_cst 0xa7c5f3f0 constant invariant 32> unit size <integer_cst 0xa7c5f180 constant invariant 4> align 32 symtab 0 alias set 4 fields <field_decl 0xa7cebe60 decl type <integer_type 0xa7c71284 int> SI file t.i line 3 size <integer_cst 0xa7c5f3f0 32> unit size <integer_cst 0xa7c5f180 4> align 32 offset_align 128 offset <integer_cst 0xa7c5f198 constant invariant 0> bit offset <integer_cst 0xa7c5f978 constant invariant 0> context <record_type 0xa7cebe04 dw_fde_struct>> context <translation_unit_decl 0xa7c77f08 D.1540> pointer_to_this <pointer_type 0xa7cebebc> chain <type_decl 0xa7c77dd0 D.1520>> sizes-gimplified public unsigned SI size <integer_cst 0xa7c5f3f0 32> unit size <integer_cst 0xa7c5f180 4> align 32 symtab 0 alias set 2> note the identical TREE_TYPE (type). And note that we have a NOP_EXPR wrapping the correct type. We arrive there by fold_used_pointer, which is simplifying casts but not re-folding the arguments to the plus/minus in if (code == PLUS_EXPR) expr = chrec_fold_plus (TREE_TYPE (expr), new0, new1); else expr = chrec_fold_minus (TREE_TYPE (expr), new0, new1); The following fixes it: Index: tree-scalar-evolution.c =================================================================== *** tree-scalar-evolution.c (revision 116257) --- tree-scalar-evolution.c (working copy) *************** fold_used_pointer (tree expr) *** 1847,1852 **** --- 1847,1854 ---- if (new0 == op0 && new1 == op1) return expr; + new0 = chrec_convert (TREE_TYPE (expr), new0, NULL_TREE); + new1 = chrec_convert (TREE_TYPE (expr), new1, NULL_TREE); if (code == PLUS_EXPR) expr = chrec_fold_plus (TREE_TYPE (expr), new0, new1); else -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28776