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)
{
}
}
+ /* 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
--- /dev/null
+! { 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