Skip to content

[Flang] flang-new-20 Segmentation fault with open(,status=old) of non existing file when setting MALLOC_PERTURB #111404

@edoapra

Description

@edoapra

When compiling the code below with the current flang-new-20 and executing with MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) and with the file to be opened being not available, the code stops with a segmentation fault.
flang-new-18 and flang-new-19 are not affected by this issue.
Code

      program test
      implicit none
      logical status
      open(unit=10,file='./nwchemrc',
     +     status='old',err=9999)
      write(6,*) ' open ok'
      stop
 9999 continue
      write(6,*) ' open failed'
      end

gdb stack

Program received signal SIGSEGV, Segmentation fault.
0x000055555557a076 in Fortran::runtime::io::ExternalFileUnit::EndIoStatement() ()
(gdb) where
#0  0x000055555557a076 in Fortran::runtime::io::ExternalFileUnit::EndIoStatement() ()
#1  0x000055555556f52d in Fortran::runtime::io::IoStatementState::EndIoStatement() ()
#2  0x00005555555566d4 in _QQmain ()
#3  0x0000555555556772 in main ()

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]flang:runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions