https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119502
Bug ID: 119502
Summary: Runtime segfault when closing invalid unit
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
The following code crashes with a segfault:
program foo
integer :: iun = -1
close (iun)
end
Excerpt from valgrind:
==28254== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==28254== at 0x4A3E41C: __pthread_kill_implementation (in /lib64/libc.so.6)
==28254== by 0x49EC841: raise (in /lib64/libc.so.6)
==28254== by 0x49EC8FF: ??? (in /lib64/libc.so.6)
==28254== by 0x40699B: _gfortrani_close_share (unix.c:1889)
==28254== by 0x404060: _gfortran_st_close (close.c:87)
We could handle this more graciously...