re PR fortran/85687 (ICE in gfc_sym_identifier, at fortran/trans-decl.c:351)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 10 May 2018 22:49:44 +0000 (22:49 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 10 May 2018 22:49:44 +0000 (22:49 +0000)
2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85687
* check.c (gfc_check_rank): Check that the argument is a data object.

2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/85687
* gfortran.dg/pr85687.f90: new test.

From-SVN: r260141

gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr85687.f90 [new file with mode: 0644]

index 09d015c..03dbc62 100644 (file)
@@ -1,5 +1,10 @@
 2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/85687
+       * check.c (gfc_check_rank): Check that the argument is a data object.
+
+2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/85521
        * array.c (gfc_resolve_character_array_constructor): Substrings
        with upper bound smaller than lower bound are zero length strings.
index 61b72c1..052e326 100644 (file)
@@ -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 "
index 73f74e0..bafd284 100644 (file)
@@ -1,5 +1,10 @@
 2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>
 
+       PR fortran/85687
+       * gfortran.dg/pr85687.f90: new test.
+
+2018-05-10  Steven G. Kargl  <kargl@gcc.gnu.org>
+
        PR fortran/85521
        * gfortran.dg/pr85521_1.f90: New test.
        * gfortran.dg/pr85521_2.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr85687.f90 b/gcc/testsuite/gfortran.dg/pr85687.f90
new file mode 100644 (file)
index 0000000..03bc211
--- /dev/null
@@ -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