Debian Codegraph @

gcc/testsuite/gfortran.dg/open_negative_unit_1.f90

raw
1 ! { dg-do run }
2 ! PR48618 - Negative unit number in OPEN(...) is sometimes allowed
3 !
4 ! Test originally from Janne Blomqvist in PR:
5 ! http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48618
6
7 program nutest
8 implicit none
9 logical l
10 integer id, ios
11
12 open(newunit=id, file="foo_open_negative_unit_1.txt", iostat=ios)
13 if (ios /= 0) STOP 1
14
15 open(id, file="bar.txt", iostat=ios)
16 if (ios /= 0) STOP 2
17
18 close(id, status="delete")
19
20 open(unit=10, file="foo_open_negative_unit_1.txt", status="old", iostat=ios)
21 if (ios /= 0) STOP 3
22
23 close(10, status="delete")
24
25 open(-10, file="foo_open_negative_unit_1.txt", iostat=ios)
26 if (ios == 0) STOP 4
27
28 inquire(file="foo_open_negative_unit_1.txt", exist=l)
29 if (l) STOP 5
30 end program nutest