From ab0f6d4c5fa6880d5461e2b6bad1879d6a84744f Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 28 Aug 2019 19:54:23 +0000 Subject: [PATCH] re PR fortran/91564 (ICE in gimplify_expr, at gimplify.c:14147) 2019-08-28 Steven G. Kargl PR fortran/91564 * check.c (gfc_check_kill_sub): Additional checks on status dummy argument. 2019-08-28 Steven G. Kargl PR fortran/91564 * gfortran.dg/pr91564.f90: New test. From-SVN: r275005 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/check.c | 16 ++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr91564.f90 | 16 ++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr91564.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6b760ce106e..b118913aa15 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-08-28 Steven G. Kargl + + PR fortran/91564 + * check.c (gfc_check_kill_sub): Additional checks on status dummy + argument. + 2019-08-28 Mark Eggleston * intrinsics.text: Corrected stated standard for intrinsics diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 2bd8bc37556..a04f9fbb2a9 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -3301,6 +3301,22 @@ gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig, gfc_expr *status) if (!scalar_check (status, 2)) return false; + + if (status->expr_type != EXPR_VARIABLE) + { + gfc_error ("STATUS at %L shall be an INTENT(OUT) variable", + &status->where); + return false; + } + + if (status->expr_type == EXPR_VARIABLE + && status->symtree && status->symtree->n.sym + && status->symtree->n.sym->attr.intent == INTENT_IN) + { + gfc_error ("%qs at %L shall be an INTENT(OUT) variable", + status->symtree->name, &status->where); + return false; + } } return true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e7c31b1ab7..06d8b1bccd2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-28 Steven G. Kargl + + PR fortran/91564 + * gfortran.dg/pr91564.f90: New test. + 2019-08-28 Martin Sebor PR tree-optimization/91457 diff --git a/gcc/testsuite/gfortran.dg/pr91564.f90 b/gcc/testsuite/gfortran.dg/pr91564.f90 new file mode 100644 index 00000000000..57783abe1f8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr91564.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! PR fortran/91564 +! Contributed by Gerhard Steinmetz. +program p + integer i, j + call kill (1, 2, 3) ! { dg-error "shall be an INTENT" } + i = 42 + call bar(i, j) +end + +subroutine bar(n, m) + integer, intent(in) :: n + integer, intent(inout) :: m + call kill (1, 3, n) ! { dg-error "shall be an INTENT" } + call kill (1, 3, m) +end subroutine bar -- 2.30.2