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

            Bug ID: 118747
           Summary: [15 Regression]: seg fault on accessing an elemental
                    procedure dummy argument's deferred-length componeent
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

% cat all.f90 
  implicit none

  type string_t
    character(len=:), allocatable :: string_
  end type

  call check_allocation([foo()])

contains

  type(string_t) function foo()
    foo%string_ = "foo"
  end function

  elemental subroutine check_allocation(string)
    type(string_t), intent(in) ::  string
    if (.not. allocated(string%string_)) error stop "unallocated"
  end subroutine

end

% gfortran all.f90 

% ./a.out
a.out(64876,0x1eeb90f40) malloc: *** error for object 0x600000bd8030: pointer
being freed was not allocated
a.out(64876,0x1eeb90f40) malloc: *** set a breakpoint in malloc_error_break to
debug

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x1031a2b63
#1  0x1031a1ae3
#2  0x186d72583
#3  0x186d41c1f
#4  0x186c4ea2f
#5  0x186b5edc3
#6  0x186b6242f
#7  0x186b7c493
#8  0x102b33d57
#9  0x102b33e5b
zsh: abort      ./a.out

% gfortran --version
GNU Fortran (GCC) 15.0.1 20250119 (experimental)

Reply via email to