aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/io.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2019-02-22 20:35:38 +0000
committerHarald Anlauf <anlauf@gcc.gnu.org>2019-02-22 20:35:38 +0000
commit56bf85c1a747ae517abb861dddaf64c4927e8139 (patch)
tree402881984d32b47a6ad1deb73201a5fc1d63f5ca /gcc/fortran/io.c
parentf3e1797acfe601c6ddd047d1afebe1af69426ae1 (diff)
downloadgcc-56bf85c1a747ae517abb861dddaf64c4927e8139.zip
gcc-56bf85c1a747ae517abb861dddaf64c4927e8139.tar.gz
gcc-56bf85c1a747ae517abb861dddaf64c4927e8139.tar.bz2
re PR fortran/83057 (OPEN without a filename and without STATUS='SCRATCH' could produce a warning)
2019-02-22 Harald Anlauf <anlauf@gmx.de> PR fortran/83057 * io.c (gfc_match_open): Fix logic in checks of OPEN statement when NEWUNIT= is specified. PR fortran/83057 * gfortran.dg/newunit_6.f90: New test. From-SVN: r269134
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r--gcc/fortran/io.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 95b3013..9828897 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -2504,16 +2504,15 @@ gfc_match_open (void)
goto cleanup;
}
- if (!open->file && open->status)
- {
- if (open->status->expr_type == EXPR_CONSTANT
+ if (!open->file &&
+ (!open->status ||
+ (open->status->expr_type == EXPR_CONSTANT
&& gfc_wide_strncasecmp (open->status->value.character.string,
- "scratch", 7) != 0)
- {
+ "scratch", 7) != 0)))
+ {
gfc_error ("NEWUNIT specifier must have FILE= "
"or STATUS='scratch' at %C");
goto cleanup;
- }
}
}
else if (!open->unit)