From 885b8230a1f49f57720582b6bc811868e7acc418 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Tue, 26 Sep 2017 18:32:16 +0000 Subject: [PATCH] frontend-passes.c (do_subscript): Don't do anything if inside an associate list. 2017-09-26 Thomas Koenig * frontend-passes.c (do_subscript): Don't do anything if inside an associate list. 2017-09-26 Thomas Koenig * gfortran.dg/gomp/associate1.f90: Remove unnecessary warning from associate construct and do loop. From-SVN: r253211 --- gcc/fortran/frontend-passes.c | 4 ++++ gcc/testsuite/gfortran.dg/gomp/associate1.f90 | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 93f2c0fa038..ae4fba63b3c 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -2484,6 +2484,10 @@ do_subscript (gfc_expr **e) if (v->expr_type == EXPR_CONSTANT) return 0; + /* Wrong warnings will be generated in an associate list. */ + if (in_assoc_list) + return 0; + for (ref = v->ref; ref; ref = ref->next) { if (ref->type == REF_ARRAY && ref->u.ar.type == AR_ELEMENT) diff --git a/gcc/testsuite/gfortran.dg/gomp/associate1.f90 b/gcc/testsuite/gfortran.dg/gomp/associate1.f90 index 5412301fe87..abc5ae95a0d 100644 --- a/gcc/testsuite/gfortran.dg/gomp/associate1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/associate1.f90 @@ -14,7 +14,7 @@ program associate1 type(dt) :: b(3) i = 1 j = 2 - associate(k => v, l => a(i, j), m => a(i, :)) ! { dg-warning "out of bounds" } + associate(k => v, l => a(i, j), m => a(i, :)) associate(n => b(j)%c(:, :)%i, o => a, p => b) !$omp parallel shared (l) ! { dg-error "ASSOCIATE name" } !$omp end parallel @@ -75,7 +75,7 @@ program associate1 end do k = 1 !$omp simd linear (k : 2) ! { dg-error "ASSOCIATE name" } - do i = 1, 10 ! { dg-warning "out of bounds" } + do i = 1, 10 k = k + 2 end do end associate -- 2.30.2