Commit 72eb8e78 by Steven G. Kargl

re PR fortran/88205 (ICE in gfc_wide_strncasecmp, at fortran/scanner.c:249)

2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/88205
	* io.c (gfc_match_open): Move NEWUNIT checks to after STATUS checks.

2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/88205
	* gfortran.dg/pr88205.f90: New unit.

From-SVN: r266936
parent 899b3981
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88205
* io.c (gfc_match_open): Move NEWUNIT checks to after STATUS checks.
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88206
* match.c (gfc_match_type_spec): REAL can be an intrinsic function.
......
......@@ -2150,33 +2150,6 @@ gfc_match_open (void)
warn = (open->err || open->iostat) ? true : false;
/* Checks on NEWUNIT specifier. */
if (open->newunit)
{
if (open->unit)
{
gfc_error ("UNIT specifier not allowed with NEWUNIT at %C");
goto cleanup;
}
if (!open->file && open->status)
{
if (open->status->expr_type == EXPR_CONSTANT
&& gfc_wide_strncasecmp (open->status->value.character.string,
"scratch", 7) != 0)
{
gfc_error ("NEWUNIT specifier must have FILE= "
"or STATUS='scratch' at %C");
goto cleanup;
}
}
}
else if (!open->unit)
{
gfc_error ("OPEN statement at %C must have UNIT or NEWUNIT specified");
goto cleanup;
}
/* Checks on the ACCESS specifier. */
if (open->access && open->access->expr_type == EXPR_CONSTANT)
{
......@@ -2501,6 +2474,33 @@ gfc_match_open (void)
}
}
/* Checks on NEWUNIT specifier. */
if (open->newunit)
{
if (open->unit)
{
gfc_error ("UNIT specifier not allowed with NEWUNIT at %C");
goto cleanup;
}
if (!open->file && open->status)
{
if (open->status->expr_type == EXPR_CONSTANT
&& gfc_wide_strncasecmp (open->status->value.character.string,
"scratch", 7) != 0)
{
gfc_error ("NEWUNIT specifier must have FILE= "
"or STATUS='scratch' at %C");
goto cleanup;
}
}
}
else if (!open->unit)
{
gfc_error ("OPEN statement at %C must have UNIT or NEWUNIT specified");
goto cleanup;
}
/* Things that are not allowed for unformatted I/O. */
if (open->form && open->form->expr_type == EXPR_CONSTANT
&& (open->delim || open->decimal || open->encoding || open->round
......
2018-12-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/88205
* gfortran.dg/pr88205.f90: New unit.
2018-12-09 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/88039
......
! { dg-do compile }
! PR fortran/88205
subroutine s1
real, parameter :: status = 0
open (newunit=n, status=status) ! { dg-error "STATUS requires" }
end
subroutine s2
complex, parameter :: status = 0
open (newunit=n, status=status) ! { dg-error "STATUS requires" }
end
program p
logical, parameter :: status = .false.
open (newunit=a, status=status) ! { dg-error "STATUS requires" }
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