diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/open_negative_unit_1.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 b/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 new file mode 100644 index 00000000000..6446436c885 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 @@ -0,0 +1,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 |