Commit 56bf85c1 by Harald Anlauf Committed by Harald Anlauf

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
parent f3e1797a
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.
2019-02-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/89431
......
......@@ -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)
......
2019-02-22 Harald Anlauf <anlauf@gmx.de>
PR fortran/83057
* gfortran.dg/newunit_6.f90: New test.
2019-02-22 Marek Polacek <polacek@redhat.com>
PR c++/89420 - ICE with CAST_EXPR in explicit-specifier.
......
! { dg-do compile }
!
! PR fortran/83057 - OPEN without a filename and without STATUS='SCRATCH'
! could produce a warning
open(newunit=iun,file="file") ! this is ok
open(newunit=jun,status="scratch") ! this too
open(newunit=lun) ! { dg-error "NEWUNIT specifier must have" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment