Bug 83078 - ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1110
Summary: ICE in gfc_typenode_for_spec, at fortran/trans-types.c:1110
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2017-11-20 17:21 UTC by G. Steinmetz
Modified: 2019-03-28 21:04 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-11-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2017-11-20 17:21:31 UTC
With an undefined value "n" :

$ cat z1.f90
program p
   implicit none
   type t
      integer :: a(n)
   end type t
   type(t) :: x = t([1, 2])
end


$ gfortran-8-20171119 -c z1.f90
z1.f90:1:0:

 program p

internal compiler error: in gfc_typenode_for_spec, at fortran/trans-types.c:1110
0x7a9ee3 gfc_typenode_for_spec(gfc_typespec*, int)
        ../../gcc/fortran/trans-types.c:1110
0x7aa22a gfc_sym_type(gfc_symbol*)
        ../../gcc/fortran/trans-types.c:2213
0x755974 gfc_get_symbol_decl(gfc_symbol*)
        ../../gcc/fortran/trans-decl.c:1716
0x7589c7 generate_local_decl
        ../../gcc/fortran/trans-decl.c:5525
0x71d9ab do_traverse_symtree
        ../../gcc/fortran/symbol.c:4157
0x759622 generate_local_vars
        ../../gcc/fortran/trans-decl.c:5725
0x759622 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6372
0x6eb720 translate_all_program_units
        ../../gcc/fortran/parse.c:6091
0x6eb720 gfc_parse_file()
        ../../gcc/fortran/parse.c:6294
0x72ff5f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:204
Comment 1 G. Steinmetz 2017-11-20 17:22:00 UTC
Detected without "implicit none" :


$ cat z2.f90
program p
   type t
      integer :: a(n)
   end type t
   type(t) :: x = t([1, 2])
end


$ gfortran-8-20171119 -c z2.f90
z2.f90:3:19:

       integer :: a(n)
                   1
Error: Variable 'n' at (1) in this context must be constant
z2.f90:3:19:

       integer :: a(n)
                   1
Error: Variable 'n' at (1) in this context must be constant
Comment 2 Dominique d'Humieres 2017-11-21 12:25:36 UTC
Confirmed from 4.8 up to trunk (8.0).