diff options
-rw-r--r-- | gcc/fortran/frontend-passes.c | 4 | ||||
-rw-r--r-- | 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 93f2c0f..ae4fba6 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 5412301..abc5ae9 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 |