Skip to content

Commit

Permalink
2018-12-10 Steven G. Kargl <[email protected]>
Browse files Browse the repository at this point in the history
	PR fortran/97922
	* io.c (gfc_match_open): Additional checks on ASYNCHRONOUS.

2018-12-10  Steven G. Kargl  <[email protected]>

	PR fortran/97922
	* gfortran.dg/io_constraints_8.f90: Update error message.
	* gfortran.dg/pr87922.f90: New test.

From-SVN: r266968
  • Loading branch information
Steven G. Kargl committed Dec 11, 2018
1 parent 1486eb7 commit 87550b7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gcc/fortran/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-12-10 Steven G. Kargl <[email protected]>

PR fortran/97922
* io.c (gfc_match_open): Additional checks on ASYNCHRONOUS.

2018-12-10 Steven G. Kargl <[email protected]>

PR fortran/88269
Expand Down
30 changes: 30 additions & 0 deletions gcc/fortran/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,21 @@ gfc_match_open (void)
if (!is_char_type ("ASYNCHRONOUS", open->asynchronous))
goto cleanup;

if (open->asynchronous->ts.kind != 1)
{
gfc_error ("ASYNCHRONOUS= specifier at %L must be of default "
"CHARACTER kind", &open->asynchronous->where);
return MATCH_ERROR;
}

if (open->asynchronous->expr_type == EXPR_ARRAY
|| open->asynchronous->expr_type == EXPR_STRUCTURE)
{
gfc_error ("ASYNCHRONOUS= specifier at %L must be scalar",
&open->asynchronous->where);
return MATCH_ERROR;
}

if (open->asynchronous->expr_type == EXPR_CONSTANT)
{
static const char * asynchronous[] = { "YES", "NO", NULL };
Expand Down Expand Up @@ -3799,6 +3814,21 @@ if (condition) \
if (!is_char_type ("ASYNCHRONOUS", dt->asynchronous))
return MATCH_ERROR;

if (dt->asynchronous->ts.kind != 1)
{
gfc_error ("ASYNCHRONOUS= specifier at %L must be of default "
"CHARACTER kind", &dt->asynchronous->where);
return MATCH_ERROR;
}

if (dt->asynchronous->expr_type == EXPR_ARRAY
|| dt->asynchronous->expr_type == EXPR_STRUCTURE)
{
gfc_error ("ASYNCHRONOUS= specifier at %L must be scalar",
&dt->asynchronous->where);
return MATCH_ERROR;
}

if (!compare_to_allowed_values
("ASYNCHRONOUS", asynchronous, NULL, NULL,
dt->asynchronous->value.character.string,
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2018-12-10 Steven G. Kargl <[email protected]>

PR fortran/97922
* gfortran.dg/io_constraints_8.f90: Update error message.
* gfortran.dg/pr87922.f90: New test.

2018-12-10 Martin Sebor <[email protected]>

PR tree-optimization/86196
Expand Down
2 changes: 1 addition & 1 deletion gcc/testsuite/gfortran.dg/io_constraints_8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

OPEN(99, access=4_'direct') ! { dg-error "must be a character string of default kind" }
OPEN(99, action=4_'read') ! { dg-error "must be a character string of default kind" }
OPEN(99, asynchronous=4_'no') ! { dg-error "must be a character string of default kind" })
OPEN(99, asynchronous=4_'no') ! { dg-error "must be of default CHARACTER kind" }
OPEN(99, blank=4_'null') ! { dg-error "must be a character string of default kind" }
OPEN(99, decimal=4_'comma') ! { dg-error "must be a character string of default kind" }
OPEN(99, delim=4_'quote') ! { dg-error "must be a character string of default kind" }
Expand Down
10 changes: 10 additions & 0 deletions gcc/testsuite/gfortran.dg/pr87922.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
! { dg-do compile }
! PR fortran/87922
subroutine p
read(1, asynchronous=['no']) ! { dg-error "must be scalar" }
read(1, asynchronous=[character::]) ! { dg-error "must be scalar" }
end
subroutine q
write(1, asynchronous=['no']) ! { dg-error "must be scalar" }
write(1, asynchronous=[character::]) ! { dg-error "must be scalar" }
end

0 comments on commit 87550b7

Please sign in to comment.