From 4c27f900950ed0ecb2897a8931c5cc348b1980be Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 27 Oct 2020 10:43:27 +0100 Subject: [PATCH] [Fortran] Remove OpenACC 'loop' inside 'parallel' special-case code Instead, use the generic middle-end code, like already used for Fortran OpenACC 'loop' inside other compute constructs, orphaned 'loop' constructs, and C, C++ generally. gcc/fortran/ * openmp.c (oacc_is_parallel, resolve_oacc_params_in_parallel): Remove. (resolve_oacc_loop_blocks): Don't call the former. gcc/testsuite/ * gfortran.dg/goacc/loop-2-parallel-3.f95: Adjust. --- gcc/fortran/openmp.c | 37 ------------------- .../gfortran.dg/goacc/loop-2-parallel-3.f95 | 24 ++++++------ 2 files changed, 12 insertions(+), 49 deletions(-) diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 1891ac5591b..2270c858f39 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -6403,11 +6403,6 @@ resolve_omp_do (gfc_code *code) } } -static bool -oacc_is_parallel (gfc_code *code) -{ - return code->op == EXEC_OACC_PARALLEL || code->op == EXEC_OACC_PARALLEL_LOOP; -} static gfc_statement omp_code_to_statement (gfc_code *code) @@ -6666,26 +6661,6 @@ resolve_oacc_nested_loops (gfc_code *code, gfc_code* do_code, int collapse, } -static void -resolve_oacc_params_in_parallel (gfc_code *code, const char *clause, - const char *arg) -{ - fortran_omp_context *c; - - if (oacc_is_parallel (code)) - gfc_error ("!$ACC LOOP %s in PARALLEL region doesn't allow " - "%s arguments at %L", clause, arg, &code->loc); - for (c = omp_current_ctx; c; c = c->previous) - { - if (oacc_is_loop (c->code)) - break; - if (oacc_is_parallel (c->code)) - gfc_error ("!$ACC LOOP %s in PARALLEL region doesn't allow " - "%s arguments at %L", clause, arg, &code->loc); - } -} - - static void resolve_oacc_loop_blocks (gfc_code *code) { @@ -6697,18 +6672,6 @@ resolve_oacc_loop_blocks (gfc_code *code) gfc_error ("Tiled loop cannot be parallelized across gangs, workers and " "vectors at the same time at %L", &code->loc); - if (code->ext.omp_clauses->gang - && code->ext.omp_clauses->gang_num_expr) - resolve_oacc_params_in_parallel (code, "GANG", "num"); - - if (code->ext.omp_clauses->worker - && code->ext.omp_clauses->worker_expr) - resolve_oacc_params_in_parallel (code, "WORKER", "num"); - - if (code->ext.omp_clauses->vector - && code->ext.omp_clauses->vector_expr) - resolve_oacc_params_in_parallel (code, "VECTOR", "length"); - if (code->ext.omp_clauses->tile_list) { gfc_expr_list *el; diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95 index 03cae74c022..5379fba16ed 100644 --- a/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95 @@ -5,52 +5,52 @@ program test integer :: i !$acc parallel - !$acc loop gang(5) ! { dg-error "num arguments" } + !$acc loop gang(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc loop gang(num:5) ! { dg-error "num arguments" } + !$acc loop gang(num:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc loop worker(5) ! { dg-error "num arguments" } + !$acc loop worker(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc loop worker(num:5) ! { dg-error "num arguments" } + !$acc loop worker(num:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc loop vector(5) ! { dg-error "length arguments" } + !$acc loop vector(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc loop vector(length:5) ! { dg-error "length arguments" } + !$acc loop vector(length:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO !$acc end parallel - !$acc parallel loop gang(5) ! { dg-error "num arguments" } + !$acc parallel loop gang(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc parallel loop gang(num:5) ! { dg-error "num arguments" } + !$acc parallel loop gang(num:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc parallel loop worker(5) ! { dg-error "num arguments" } + !$acc parallel loop worker(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc parallel loop worker(num:5) ! { dg-error "num arguments" } + !$acc parallel loop worker(num:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc parallel loop vector(5) ! { dg-error "length arguments" } + !$acc parallel loop vector(5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO - !$acc parallel loop vector(length:5) ! { dg-error "length arguments" } + !$acc parallel loop vector(length:5) ! { dg-error "argument not permitted" } DO i = 1,10 ENDDO end -- 2.30.2