]> 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 17:58:03 +0000 (17:58 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 11 May 2018 17:58:03 +0000 (17:58 +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: r260174

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

index 488c86fc3b36d3b66ec59171d07d4b5c39531a75..2791e26202e8445e4d191dffbc96a99b644375a0 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 6e62d409e7bcf4724dcdbe8eb8fa81da935b5815..f5e0ab5f5b8e3492c21b4bc161fb0358682076f9 100644 (file)
@@ -3764,8 +3764,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 a1c9c61ca08fc6820e3c10b51c4d05cd3b2d3d55..82ab93d8b179d33642241b620cd1dacfbada002f 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-06  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        PR fortran/85507
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