From 602f77a67267043aac48895540da838d4c5531bb Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sat, 27 Aug 2016 15:45:35 +0000 Subject: [PATCH] re PR fortran/77380 (ICE in gfc_check_dependency, at fortran/dependency.c:1255) 2016-08-27 Steven G. Kargl PR fortran/77380 * dependency.c (gfc_check_dependency): Do not assert with -fcoarray=lib. 2016-08-27 Steven G. Kargl PR fortran/77380 * gfortran.dg/pr77380.f90: New test. From-SVN: r239796 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/dependency.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr77380.f90 | 6 ++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr77380.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f15e93617ad..9ac5721cf84 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-08-27 Steven G. Kargl + + PR fortran/77380 + * dependency.c (gfc_check_dependency): Do not assert with + -fcoarray=lib. + 2016-08-27 Steven G. Kargl PR fortran/77372 diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index f117de03640..58a443be09a 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -1252,6 +1252,12 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68e1804b883..7d117eed30a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-08-27 Steven G. Kargl + + PR fortran/77380 + * gfortran.dg/pr77380.f90: New test. + 2016-08-27 Steven G. Kargl PR fortran/77372 diff --git a/gcc/testsuite/gfortran.dg/pr77380.f90 b/gcc/testsuite/gfortran.dg/pr77380.f90 new file mode 100644 index 00000000000..f369be673a9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77380.f90 @@ -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 -- 2.30.2