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

            Bug ID: 93175
           Summary: ICE involving nested parameterized derived types
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: townsend at astro dot wisc.edu
  Target Milestone: ---

I get an ICE when compiling this example code (involving a PDT inside a PDT):

----
module pdt_test_m

  type :: matrix (k,n)
     integer, kind :: k
     integer, len  :: n
     real(k)       :: a(n,n)
  end type matrix

  type :: problem(n)
     integer, len               :: n
     type(matrix(kind(0.D0),n)) :: m
  end type problem

end module pdt_test_m

program pdt_test

  use pdt_test_m

  implicit none

  type(problem(2)) :: p

  p%m%a = 1.

  print *, p%n
  print *, p%m%n
  print *, p%m%a

end program pdt_test
----

The error is as follows (on Linux):

pdt-test.f90:30:0:

   30 | end program pdt_test
      | 
internal compiler error: Segmentation fault
0xad494f crash_signal
        /root/sdk2/build/gcc/gcc/toplev.c:326
0x59e47f insert_parameter_exprs
        /root/sdk2/build/gcc/gcc/fortran/decl.c:3491
0x59e47f insert_parameter_exprs
        /root/sdk2/build/gcc/gcc/fortran/decl.c:3477
0x5bcced gfc_traverse_expr(gfc_expr*, gfc_symbol*, bool (*)(gfc_expr*,
gfc_symbol*, int*), int)
        /root/sdk2/build/gcc/gcc/fortran/expr.c:5144
0x670ffa structure_alloc_comps
        /root/sdk2/build/gcc/gcc/fortran/trans-array.c:9353
0x674a80 gfc_allocate_pdt_comp(gfc_symbol*, tree_node*, int,
gfc_actual_arglist*)
        /root/sdk2/build/gcc/gcc/fortran/trans-array.c:9630
0x670924 structure_alloc_comps
        /root/sdk2/build/gcc/gcc/fortran/trans-array.c:9428
0x674a80 gfc_allocate_pdt_comp(gfc_symbol*, tree_node*, int,
gfc_actual_arglist*)
        /root/sdk2/build/gcc/gcc/fortran/trans-array.c:9630
0x6833e3 gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*)
        /root/sdk2/build/gcc/gcc/fortran/trans-decl.c:4599
0x6859f9 gfc_generate_function_code(gfc_namespace*)
        /root/sdk2/build/gcc/gcc/fortran/trans-decl.c:6851
0x6102e6 translate_all_program_units
        /root/sdk2/build/gcc/gcc/fortran/parse.c:6134
0x6102e6 gfc_parse_file()
        /root/sdk2/build/gcc/gcc/fortran/parse.c:6367
0x65aa5f gfc_be_parse_file
        /root/sdk2/build/gcc/gcc/fortran/f95-lang.c:204
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

(On OSX I also get a segfault, but the nice backtrace info is missing. Is there
a build flag for gcc to fix the lack of backtrace?)

cheers,

Rich

Reply via email to