[Bug fortran/29820] ICE in fold_convert, at fold-const.c:2146

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Nov 14 09:50:00 GMT 2006



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-11-14 09:50 -------
I'm confused that for

  type geodetic
     real :: h
  end type geodetic

gfortran is using a record type but still goes the scalar assignment path. 
With
gfc_trans_scalar_assign changed to read

      gcc_assert (!AGGREGATE_TYPE_P (TREE_TYPE (lse->expr))
                  || TREE_TYPE (lse->expr) == TREE_TYPE (rse->expr));
      gfc_add_modify_expr (&block, lse->expr,
                           !AGGREGATE_TYPE_P (TREE_TYPE (lse->expr))
                           ? fold_convert (TREE_TYPE (lse->expr), rse->expr)
                           : rse->expr);

we can see that we don't have the required type-unification for geodetic:

(gdb) call debug_tree (lse->expr)
 <indirect_ref 0x2b0877c769c0
    type <record_type 0x2b0877d4ea50 geodetic SF
        size <integer_cst 0x2b0877c6cba0 constant invariant 32>
        unit size <integer_cst 0x2b0877c6c6c0 constant invariant 4>
        align 32 symtab 0 alias set -1
        fields <field_decl 0x2b0877d4ce40 h type <real_type 0x2b0877c87210
real4>
            SF file t.f90 line 9 size <integer_cst 0x2b0877c6cba0 32> unit size
<integer_cst 0x2b0877c6c6c0 4>
            align 32 offset_align 128
            offset <integer_cst 0x2b0877c6c6f0 constant invariant 0>
            bit offset <integer_cst 0x2b0877c842d0 constant invariant 0>
context <record_type 0x2b0877d4ea50 geodetic>>
        reference_to_this <reference_type 0x2b0877d4eb00> chain <type_decl
0x2b0877c91680 D.1330>>

(gdb) call debug_tree (rse->expr)
 <array_ref 0x2b0877d55180
    type <record_type 0x2b0877d4ec60 geodetic SF
        size <integer_cst 0x2b0877c6cba0 constant invariant 32>
        unit size <integer_cst 0x2b0877c6c6c0 constant invariant 4>
        align 32 symtab 0 alias set -1
        fields <field_decl 0x2b0877d4cf00 h type <real_type 0x2b0877c87210
real4>
            SF file t.f90 line 9 size <integer_cst 0x2b0877c6cba0 32> unit size
<integer_cst 0x2b0877c6c6c0 4>
            align 32 offset_align 128
            offset <integer_cst 0x2b0877c6c6f0 constant invariant 0>
            bit offset <integer_cst 0x2b0877c842d0 constant invariant 0>
context <record_type 0x2b0877d4ec60 geodetic>>
        pointer_to_this <pointer_type 0x2b0877d4edc0> chain <type_decl
0x2b0877c91750 D.1335>>

(while this should be the same type, one is record_type 0x2b0877d4ec60 and
the other is record_type 0x2b0877d4ea50, which is causing this bug)


-- 


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



More information about the Gcc-bugs mailing list