https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100273

            Bug ID: 100273
           Summary: [9/10/11/12 Regression] ICE in
                    gfc_create_module_variable, at
                    fortran/trans-decl.c:5352
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Started with r7 before 20180426, r6 compiles it :


$ cat z1.f90
module m
   implicit none
contains
   character(4) function g(k)
      integer :: k
      g = f(k)
   contains
      function f(n)
         character(3), parameter :: a(2) = ['1  ', '123']
         integer :: n
         character(len_trim(a(n))) :: f
         f = 'abc'
      end
   end
end
program p
   use m
   print *, '>>' // g(1) // '<<'
   print *, '>>' // g(2) // '<<'
end


$ gfortran-6 -c z1.f90
$
$ gfortran-11-20210425 -c z1.f90
f951: internal compiler error: in gfc_create_module_variable, at
fortran/trans-decl.c:5352
0x75f716 gfc_create_module_variable
        ../../gcc/fortran/trans-decl.c:5350
0x71df02 do_traverse_symtree
        ../../gcc/fortran/symbol.c:4170
0x75fcbb gfc_generate_module_vars(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:5845
0x73a1f4 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.c:2307
0x6e6531 translate_all_program_units
        ../../gcc/fortran/parse.c:6342
0x6e6531 gfc_parse_file()
        ../../gcc/fortran/parse.c:6624
0x732d2f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

Reply via email to