summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/open_readonly_1.f90
blob: 547aa5188aec72f0a73e3f2d7760d1e4cb052358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
! { dg-do run { target fd_truncate } }
! PR19451
! Writing to a non-empty readonly file caused a segfault.
! We were still trying to write the EOR after an error ocurred
program prog
  open (unit=10, file='PR19451.dat')
  write (10,*) "Hello World"
  close (10)
  open (unit=10, file='PR19451.dat', action="read")
  write (10,*,err=20) "Hello World"
  STOP 1
  20 close (10, status='delete')
end program