https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127774
Bug ID: 127774
Summary: Runtime crash when passing a negative stride array
constructor to a structure constructor
Product: gcc
Version: 14.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
Target Milestone: ---
program mre
implicit none
type t
real, allocatable :: x(:)
end type
type(t) :: v
real :: a(3) = [1., 2., 3.]
v = t(a(3:1:-1))
print *, v%x
end program
crashes at runtime with SIGSEGV. With -O0 -fcheck=all -Wall -ggdb I get
GCC 15.2.0:
> ./a.out
In file 'structure_constructor_array_temporary.f90', around line 8: Error
allocating 18446744073709551604 bytes: Cannot allocate memory
Error termination. Backtrace:
#0 0x400ab4 in mre
at /home/lada/f/testy/bugs/structure_constructor_array_temporary.f90:8
#1 0x400ceb in main
at /home/lada/f/testy/bugs/structure_constructor_array_temporary.f90:10
GCC 7.5.0:
Operating system error: Cannot allocate memory
Memory allocation failed
Error termination. Backtrace:
Could not print backtrace: unrecognized DWARF version in .debug_info at 40
Could not print backtrace: unrecognized DWARF version in .debug_info at 40
#0 0x7f0dc64e4640 in ???
#1 0x7f0dc64e5185 in ???
#2 0x7f0dc64e5382 in ???
#3 0x400abf in mre
at /home/lada/f/testy/bugs/structure_constructor_array_temporary.f90:8
#4 0x400cc8 in main
at /home/lada/f/testy/bugs/structure_constructor_array_temporary.f90:10
Related, or duplicate(?) of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119478
Tested and affected: 7,14,15