+2019-09-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/91864
+ * gcc/fortran/io.c (match_io_element): An inquiry parameter cannot be
+ read into.
+ * gcc/fortran/match.c (gfc_match_allocate): An inquiry parameter
+ can be neither an allocate-object nor stat variable.
+ (gfc_match_deallocate): An inquiry parameter cannot be deallocated.
+
2019-09-26 Alessandro Fanfarillo <afanfa@gcc.gnu.org>
* trans-array.c (structure_alloc_comps):
{
m = gfc_match_variable (&expr, 0);
if (m == MATCH_NO)
- gfc_error ("Expected variable in READ statement at %C");
+ {
+ gfc_error ("Expecting variable in READ statement at %C");
+ m = MATCH_ERROR;
+ }
+
+ if (m == MATCH_YES && expr->expr_type == EXPR_CONSTANT)
+ {
+ gfc_error ("Expecting variable or io-implied-do in READ statement "
+ "at %L", &expr->where);
+ m = MATCH_ERROR;
+ }
if (m == MATCH_YES
&& expr->expr_type == EXPR_VARIABLE
&expr->where);
m = MATCH_ERROR;
}
-
}
else
{
if (m == MATCH_ERROR)
goto cleanup;
+ if (tail->expr->expr_type == EXPR_CONSTANT)
+ {
+ gfc_error ("Unexpected constant at %C");
+ goto cleanup;
+ }
+
if (gfc_check_do_variable (tail->expr->symtree))
goto cleanup;
tmp = NULL;
saw_stat = true;
+ if (stat->expr_type == EXPR_CONSTANT)
+ {
+ gfc_error ("STAT tag at %L cannot be a constant", &stat->where);
+ goto cleanup;
+ }
+
if (gfc_check_do_variable (stat->symtree))
goto cleanup;
if (m == MATCH_NO)
goto syntax;
+ if (tail->expr->expr_type == EXPR_CONSTANT)
+ {
+ gfc_error ("Unexpected constant at %C");
+ goto cleanup;
+ }
+
if (gfc_check_do_variable (tail->expr->symtree))
goto cleanup;
+2019-09-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/91864
+ * gcc/testsuite/gfortran.dg/pr91864.f90
+
2019-09-28 Marek Polacek <polacek@redhat.com>
PR c++/91889 - follow-up fix for DR 2352.
--- /dev/null
+program p
+ integer :: i
+ read (*,*) i%kind ! { dg-error "Expecting variable or io-implied-do" }
+end
+
+subroutine t
+ integer, allocatable :: x(:)
+ integer :: stat
+ allocate (x(3), stat=stat%kind) ! { dg-error "cannot be a constant" }
+end
+
+subroutine u
+ integer, allocatable :: x(:)
+ integer :: stat
+ allocate (x(3), stat%kind=stat) ! { dg-error "Unexpected constant" }
+end
+
+subroutine v
+ integer, allocatable :: x(:)
+ integer :: stat
+ deallocate (x, stat%kind=stat) ! { dg-error "Unexpected constant" }
+end