From 9724eac36ac38dc3eb0fdc8547eb77af8e8a2fdf Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Thu, 10 May 2018 22:49:44 +0000 Subject: [PATCH] re PR fortran/85687 (ICE in gfc_sym_identifier, at fortran/trans-decl.c:351) 2018-05-10 Steven G. Kargl PR fortran/85687 * check.c (gfc_check_rank): Check that the argument is a data object. 2018-05-10 Steven G. Kargl PR fortran/85687 * gfortran.dg/pr85687.f90: new test. From-SVN: r260141 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/check.c | 7 +++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr85687.f90 | 8 ++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr85687.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 09d015c12ba..03dbc626c92 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-05-10 Steven G. Kargl + + PR fortran/85687 + * check.c (gfc_check_rank): Check that the argument is a data object. + 2018-05-10 Steven G. Kargl PR fortran/85521 diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 61b72c12bbe..052e3267014 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -3886,8 +3886,11 @@ gfc_check_rank (gfc_expr *a) ? a->value.function.esym->result->attr.pointer : a->symtree->n.sym->result->attr.pointer; - if (a->expr_type == EXPR_OP || a->expr_type == EXPR_NULL - || a->expr_type == EXPR_COMPCALL|| a->expr_type == EXPR_PPC + if (a->expr_type == EXPR_OP + || a->expr_type == EXPR_NULL + || a->expr_type == EXPR_COMPCALL + || a->expr_type == EXPR_PPC + || a->ts.type == BT_PROCEDURE || !is_variable) { gfc_error ("The argument of the RANK intrinsic at %L must be a data " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73f74e08401..bafd284857a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-05-10 Steven G. Kargl + + PR fortran/85687 + * gfortran.dg/pr85687.f90: new test. + 2018-05-10 Steven G. Kargl PR fortran/85521 diff --git a/gcc/testsuite/gfortran.dg/pr85687.f90 b/gcc/testsuite/gfortran.dg/pr85687.f90 new file mode 100644 index 00000000000..03bc2119364 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr85687.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/85687 +! Code original contributed by Gerhard Steinmetz gscfq at t-oline dot de +program p + type t + end type + print *, rank(t) ! { dg-error "must be a data object" } +end -- 2.30.2