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

            Bug ID: 123348
           Summary: gfortran: internal compiler error: Segmentation fault
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jabba.laci at gmail dot com
  Target Milestone: ---

Created attachment 63185
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63185&action=edit
line 66 causes a compiler error

I have a program (see the attachment) that causes a compiler error:

$ gfortran compiler_error.f90
f951: internal compiler error: Segmentation fault
0x250b271 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x250bab0 internal_error(char const*, ...)
        ???:0
0x72ea6f gfc_find_derived_vtab(gfc_symbol*)
        ???:0
0x785452 gfc_reduce_init_expr(gfc_expr*)
        ???:0
0x753b98 gfc_match_char_spec(gfc_typespec*)
        ???:0
0x7b3e85 gfc_match_type_spec(gfc_typespec*)
        ???:0
0x7b4032 gfc_match_allocate()
        ???:0
0x81841a gfc_parse_file()
        ???:0

Here is the problematic part:

len_alloc = self%total_length() + extra
allocate (character(len=self%total_length() + extra) :: result)  ! compiler
error
! allocate (character(len=len_alloc) :: result)  ! it's OK

If you put the second line in comment and uncomment the third line, it works.

Environment: Manjaro Linux

$ gfortran --version
GNU Fortran (GCC) 15.2.1 20251112

Reply via email to