]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/85687 (ICE in gfc_sym_identifier, at fortran/trans-decl.c:351)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 11 May 2018 18:33:05 +0000 (18:33 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 11 May 2018 18:33:05 +0000 (18:33 +0000)
2018-05-11  Steven G. Kargl  <kargl@gcc.gnu.org>

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

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

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

From-SVN: r260179

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

index c430d70b70f1f181f764737539b282c4ac1c95b1..38c5891c64155fc861aeded191a379af29d9f78a 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85687
+       Backport from trunk
+       * check.c (gfc_check_rank): Check that the argument is a data object.
+
 2018-05-06  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        PR fortran/85507
index f7829db7a7d5ac1bff81c4d8085d8e867530b38a..097f9834880d90cf7091d1f606197b6d4feaab43 100644 (file)
@@ -3636,8 +3636,11 @@ gfc_check_rank (gfc_expr *a ATTRIBUTE_UNUSED)
                  ? 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 d115026258ce064d19a37750edac4edcd148faec..edfc2c4970fdcfd306be178dd5fa96e29bfe815a 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/85687
+       Backport from trunk
+       * gfortran.dg/pr85687.f90: new test.
+
 2018-05-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/83687
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