From 63617e30150f174ffa325057327c16483715aa09 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 21 Jun 2016 20:36:25 +0200 Subject: [PATCH] re PR fortran/71068 (ICE in check_data_variable(): Bad expression) 2016-06-20 Tobias Burnus PR fortran/71068 * resolve.c (resolve_function): Don't resolve caf_get/caf_send. (check_data_variable): Strip-off caf_get before checking. PR fortran/71068 * gfortran.dg/coarray/data_1.f90: New. From-SVN: r237656 --- gcc/fortran/ChangeLog | 8 +++++++- gcc/fortran/resolve.c | 11 +++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/coarray/data_1.f90 | 11 +++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/coarray/data_1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bfd3d4ef6f7..317fee5b6be 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,12 @@ +2016-06-21 Tobias Burnus + + PR fortran/71068 + * resolve.c (resolve_function): Don't resolve caf_get/caf_send. + (check_data_variable): Strip-off caf_get before checking. + 2016-06-20 Tobias Burnus - fortran/71194 + PR fortran/71194 * trans-expr.c (gfc_trans_pointer_assignment): Correctly handle RHS pointer functions. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 77f8c10bf7e..43783139752 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2923,6 +2923,13 @@ resolve_function (gfc_expr *expr) if (gfc_is_proc_ptr_comp (expr)) return true; + /* Avoid re-resolving the arguments of caf_get, which can lead to inserting + another caf_get. */ + if (sym && sym->attr.intrinsic + && (sym->intmod_sym_id == GFC_ISYM_CAF_GET + || sym->intmod_sym_id == GFC_ISYM_CAF_SEND)) + return true; + if (sym && sym->attr.intrinsic && !gfc_resolve_intrinsic (sym, &expr->where)) return false; @@ -14495,6 +14502,10 @@ check_data_variable (gfc_data_variable *var, locus *where) mpz_init_set_si (offset, 0); e = var->expr; + if (e->expr_type == EXPR_FUNCTION && e->value.function.isym + && e->value.function.isym->id == GFC_ISYM_CAF_GET) + e = e->value.function.actual->expr; + if (e->expr_type != EXPR_VARIABLE) gfc_internal_error ("check_data_variable(): Bad expression"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffb16146c31..7f5720997eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-21 Tobias Burnus + + PR fortran/71068 + * gfortran.dg/coarray/data_1.f90: New. + 2016-06-21 Wilco Dijkstra * gcc.target/aarch64/advsimd-intrinsics/vrnd.c diff --git a/gcc/testsuite/gfortran.dg/coarray/data_1.f90 b/gcc/testsuite/gfortran.dg/coarray/data_1.f90 new file mode 100644 index 00000000000..d68ac14bc18 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/data_1.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/71068 +! +! Contributed by Gerhard Steinmetz +! +program p + integer :: a(2)[*] + data a(1)[1] /1/ ! { dg-error "cannot have a coindex" } + data a(2)[1] /2/ ! { dg-error "cannot have a coindex" } +end -- 2.30.2