------- Comment #1 from fxcoudert at gcc dot gnu dot org 2007-03-16 06:54 ------- Further reduced testcase: character(5) :: string print *, transfer(string,"a",5) end
The ICE happens because the front-end generates a MULT_EXPR with a NULL second argument, in trans-array.c: if (size && !callee_alloc) { /* If or_expr is true, then the extent in at least one dimension is zero and the size is set to zero. */ size = fold_build3 (COND_EXPR, gfc_array_index_type, or_expr, gfc_index_zero_node, size); nelem = size; size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, TYPE_SIZE_UNIT (gfc_get_element_type (type))); } For some reason, TYPE_SIZE_UNIT (gfc_get_element_type (type)) is NULL, while type is: <record_type 0xb7c4ce38 array1_unknown type_1 BLK size <integer_cst 0xb7be1708 type <integer_type 0xb7bf0068 bit_size_type> constant invariant 192> unit size <integer_cst 0xb7be1720 type <integer_type 0xb7bf0000> constant invariant 24> align 32 symtab 0 alias set -1 canonical type 0xb7c4cb60 fields <field_decl 0xb7c4905c data type <pointer_type 0xb7bf0958 type <void_type 0xb7bf08f0 void> public unsigned SI size <integer_cst 0xb7be1330 constant invariant 32> unit size <integer_cst 0xb7be1168 constant invariant 4> align 32 symtab 0 alias set -1 canonical type 0xb7bf0958 pointer_to_this <pointer_type 0xb7bf8bc8>> unsigned SI file u.f90 line 1 size <integer_cst 0xb7be1330 32> unit size <integer_cst 0xb7be1168 4> align 32 offset_align 128 offset <integer_cst 0xb7be1180 constant invariant 0> bit offset <integer_cst 0xb7be1540 constant invariant 0> context <record_type 0xb7c4cb60 array_descriptor1> chain <field_decl 0xb7c490b8 offset type <integer_type 0xb7bf02d8 int4> SI file u.f90 line 1 size <integer_cst 0xb7be1330 32> unit size <integer_cst 0xb7be1168 4> align 32 offset_align 128 offset <integer_cst 0xb7be1180 0> bit offset <integer_cst 0xb7be1330 32> context <record_type 0xb7c4cb60 array_descriptor1> chain <field_decl 0xb7c49114 dtype>>>> -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|i686-pc-linux-gnu | Known to fail| |4.3.0 4.2.0 Last reconfirmed|0000-00-00 00:00:00 |2007-03-16 06:54:45 date| | Summary|ICE on |ICE on non-constant |count(transfer(...)...), |character tranfert |with non-constant transfer | |arguments. | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31193