aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90
blob: 6446436c8855c7fc963811adb06dc0c5febc98c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! { dg-do run }
! PR48618 - Negative unit number in OPEN(...) is sometimes allowed
!
! Test originally from Janne Blomqvist in PR:
! http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48618

program nutest
    implicit none
    integer id, ios

    open(newunit=id, file="foo.txt", iostat=ios)
    if (ios /= 0) call abort

    open(id, file="bar.txt", iostat=ios)
    if (ios /= 0) call abort

    close(id, status="delete")

    open(-10, file="foo.txt", iostat=ios)
    if (ios == 0) call abort
end program nutest