[PATCH] PR fortran/77380

Steve Kargl sgk@troutmask.apl.washington.edu
Thu Aug 25 22:14:00 GMT 2016


I plan to commit the following patch on Saturday if
no one objects in the next 40 or so hours.

2016-08-25  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/77380
	* dependency.c (gfc_check_dependency): Do not assert with
	-fcoarray=lib.

2016-08-25  Steven G. Kargl <kargl@gcc.gnu.org>

	PR fortran/77380
	* gfortran.dg/pr77380.f90: New test.

Index: gcc/fortran/dependency.c
===================================================================
--- gcc/fortran/dependency.c	(revision 239762)
+++ gcc/fortran/dependency.c	(working copy)
@@ -1252,6 +1252,12 @@ gfc_check_dependency (gfc_expr *expr1, g
   gfc_constructor *c;
   int n;
 
+  /* -fcoarray=lib can end up here with expr1->expr_type set to EXPR_FUNCTION
+     and a reference to _F.caf_get, so skip the assert.  */
+  if (expr1->expr_type == EXPR_FUNCTION
+      && strcmp (expr1->value.function.name, "_F.caf_get") == 0)
+    return 0;
+
   gcc_assert (expr1->expr_type == EXPR_VARIABLE);
 
   switch (expr2->expr_type)
Index: gcc/testsuite/gfortran.dg/pr77380.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77380.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77380.f90	(working copy)
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -O2" }
+program p
+   integer :: z(2)[*] = 1
+   z(:)[1] = z(:)[*]       ! { dg-error "must be a scalar at" }
+end
-- 
Steve



More information about the Fortran mailing list