2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / open_negative_unit_1.f90
blob93ea1f12178f132d53cc541c5c0dc64949e6296f
1 ! { dg-do run }
2 ! PR48618 - Negative unit number in OPEN(...) is sometimes allowed
4 ! Test originally from Janne Blomqvist in PR:
5 ! http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48618
7 program nutest
8 implicit none
9 logical l
10 integer id, ios
12 open(newunit=id, file="foo_open_negative_unit_1.txt", iostat=ios)
13 if (ios /= 0) call abort
15 open(id, file="bar.txt", iostat=ios)
16 if (ios /= 0) call abort
18 close(id, status="delete")
20 open(unit=10, file="foo_open_negative_unit_1.txt", status="old", iostat=ios)
21 if (ios /= 0) call abort
23 close(10, status="delete")
25 open(-10, file="foo_open_negative_unit_1.txt", iostat=ios)
26 if (ios == 0) call abort
28 inquire(file="foo_open_negative_unit_1.txt", exist=l)
29 if (l) call abort
30 end program nutest