------- Comment #11 from spop at gcc dot gnu dot org  2007-06-17 19:13 -------
Subject: Re:  [4.3 Regression] internal compiler error: in
build_polynomial_chrec, at tree-chrec.h:113

The ptrplus patch contains the following code:

*************** interpret_rhs_modify_stmt (struct loop *
*** 1611,1616 ****
--- 1615,1630 ----

    switch (TREE_CODE (opnd1))
      {
+     case POINTER_PLUS_EXPR:
+       opnd10 = TREE_OPERAND (opnd1, 0);
+       opnd11 = TREE_OPERAND (opnd1, 1);
+       chrec10 = analyze_scalar_evolution (loop, opnd10);
+       chrec11 = analyze_scalar_evolution (loop, opnd11);
+       chrec10 = chrec_convert (type, chrec10, at_stmt);
+       chrec11 = chrec_convert (sizetype, chrec11, at_stmt);
+       res = chrec_fold_plus (type, chrec10, chrec11);
+       break;
+
      case PLUS_EXPR:
        opnd10 = TREE_OPERAND (opnd1, 0);
        opnd11 = TREE_OPERAND (opnd1, 1);

At this point we have the following values:
(gdb) call debug_generic_expr (chrec10)
{ptr_7, +, (unsigned int) (n_20 + 65535) * 4}_1
(gdb) call debug_generic_expr (chrec11)
(unsigned int) {n_6 + 65535, +, 1}_1 * 4
(gdb) call debug_generic_expr (res)
{ptr_7 + (unsigned int) {n_6 + 65535, +, 1}_1 * 4, +, (unsigned int)
(n_20 + 65535) * 4}_1

chrec_fold_plus is completely disturbed by the "complicated" MULT_EXPR
"{}_1 * 4", and just considers this expression to be constant, and
finally it builds "ptr_7 + (unsigned int) {n_6 + 65535, +, 1}_1 * 4".

The code in chrec_fold_multiply that is producing this MULT_EXPR is:

          return fold_build2 (MULT_EXPR, type, op0, op1);

(gdb) p op0
$42 = (tree) 0xb7c27444
(gdb) pgs
4

(gdb) p op1
$43 = (tree) 0xb7ccf6a0
(gdb) pgs
(unsigned int) (n_20 + 65535);

(gdb) pt
 <nop_expr 0xb7ccf6a0
    type <integer_type 0xb7c36000 unsigned int public unsigned sizetype SI
        size <integer_cst 0xb7c27658 constant invariant 32>
        unit size <integer_cst 0xb7c27444 constant invariant 4>
        align 32 symtab 0 alias set -1 canonical type 0xb7c3c0d8
precision 32 min <integer_cst 0xb7c27674 0> max <integer_cst
0xb7c27c08 -1>>

    arg 0 <plus_expr 0xb7c2d948
        type <integer_type 0xb7c36288 short unsigned int
sizes-gimplified public unsigned HI
            size <integer_cst 0xb7c275b0 constant invariant 16>
            unit size <integer_cst 0xb7c275cc constant invariant 2>
            align 16 symtab 0 alias set -1 canonical type 0xb7c36288
precision 16 min <integer_cst 0xb7c275e8 0> max <integer_cst
0xb7c27594 65535>>

        arg 0 <ssa_name 0xb7cdb5e4 type <integer_type 0xb7c36288 short
unsigned int>
            var <var_decl 0xb7cd70b8 n> def_stmt <gimple_modify_stmt
0xb7cda770>
            version 20>
        arg 1 <integer_cst 0xb7c27594 constant invariant 65535>>>

And here, unfortunately fold_build2 does not further simplify this
expression because of the cast to uint around the PLUS_EXPR.


-- 


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

Reply via email to