[Bug fortran/51434] ICE with scalar init of an array parameter, used in DT default init with transfer

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Sat Jun 23 21:56:00 GMT 2012


Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-06-23
     Ever Confirmed|0                           |1

--- Comment #13 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-06-23 21:56:00 UTC ---
(In reply to comment #12)
> Actually, it does not - that was a left over from an earlier attempt (in
> expr.c's gfc_get_character_expr). The following should work, but is not
> regtested. I am not sure about the BT_DERIVED part; valid examples seem to work
> fine while the following invalid code ICEs in decl.c's build_struct. That's
> independent of the patch.

Indeed even with the patch I get 

f951: internal compiler error: in build_struct, at fortran/decl.c:1620

Is the following variant 

  type t
    character :: z
  end type t
  type(t), parameter :: s(5) = t('a')
  type b
      character :: y(5) = transfer('aaaaa', s%z)
  end type
  type(b) :: zz
  print *, zz
  print *, s%z

valid? Compiling it with/without the patch gives a segmentation fault. For the
patched trunk of today, the backtrace is

#0  splay_tree_min (sp=0x1) at ../../work/libiberty/splay-tree.c:485
#1  0x0000000100013d8e in gfc_constructor_first (base=<value optimized out>) at
#2  0x000000010002fbac in simplify_const_ref (p=0x142314d00) at
#3  0x0000000100030012 in simplify_const_ref (p=0x142314920) at
#4  0x00000001000306fe in gfc_simplify_expr (p=0x142314920, type=0) at
#5  0x00000001000309ea in simplify_parameter_variable (p=0x142314560, type=0)
at ../../work/gcc/fortran/expr.c:1782
#6  0x000000010002f2f8 in gfc_check_init_expr (e=0x142314560) at
#7  0x000000010002fa42 in check_init_expr_arguments (e=<value optimized out>)
at ../../work/gcc/fortran/expr.c:2228
#8  0x000000010002f95e in gfc_check_init_expr (e=0x1423142b0) at
#9  0x000000010002fae8 in gfc_reduce_init_expr (expr=0x1423142b0) at
#10 0x0000000100030b8a in gfc_match_init_expr (result=0x7fff5fbfd308) at
#11 0x0000000100021be5 in gfc_match_data_decl () at
#12 0x000000010006e41a in match_word (subr=<value optimized out>,
old_locus=0x7fff5fbfd3f0, str=<value optimized out>)
    at ../../work/gcc/fortran/parse.c:66
#13 0x000000010006ede4 in decode_statement () at
#14 0x00000001000703c5 in next_statement () at
#15 0x0000000100071ead in parse_spec (st=ST_DERIVED_DECL) at
#16 0x00000001000740f9 in parse_progunit (st=<value optimized out>) at
#17 0x000000010007507e in gfc_parse_file () at
#18 0x00000001000b4726 in gfc_be_parse_file () at
#19 0x000000010072c2af in compile_file () at ../../work/gcc/toplev.c:550
#20 0x000000010072e115 in toplev_main (argc=2, argv=0x7fff5fbfd7a0) at
#21 0x0000000100001974 in start ()

More information about the Gcc-bugs mailing list