From 26127932dd7394a8d1cc0c1f55e1de064ba175c0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 7 Jun 2012 08:36:55 +0200 Subject: [PATCH] re PR c/53580 (Internal Segmentation fault in nested "omp parallel", "omp parallel for" and "omp parallel for reduction" Directives) PR middle-end/53580 * omp-low.c (scan_omp): Change first argument to gimple_seq *, call walk_gimple_seq_mod instead of walk_gimple_seq. (scan_sharing_clauses, scan_omp_parallel, scan_omp_task, scan_omp_for, scan_omp_sections, scan_omp_single, execute_lower_omp): Adjust callers. (scan_omp_1_stmt): Likewise. If check_omp_nesting_restrictions returns false, replace stmt with GIMPLE_NOP. (check_omp_nesting_restrictions): Instead of issuing warnings, issue errors and return false if any errors were reported. * gcc.dg/gomp/nesting-1.c: Expect errors rather than warnings. * gcc.dg/gomp/critical-4.c: Likewise. * gfortran.dg/gomp/appendix-a/a.35.1.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.3.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. * c-c++-common/gomp/pr53580.c: New test. * testsuite/libgomp.c/pr26943-2.c: Remove #pragma omp barrier, use GOMP_barrier () call instead. * testsuite/libgomp.c/pr26943-3.c: Likewise. * testsuite/libgomp.c/pr26943-4.c: Likewise. * testsuite/libgomp.fortran/vla4.f90: Remove !$omp barrier, call GOMP_barrier instead. * testsuite/libgomp.fortran/vla5.f90: Likewise. From-SVN: r188298 --- gcc/ChangeLog | 14 +++ gcc/omp-low.c | 96 +++++++++++-------- gcc/testsuite/ChangeLog | 11 +++ gcc/testsuite/c-c++-common/gomp/pr53580.c | 19 ++++ gcc/testsuite/gcc.dg/gomp/critical-4.c | 4 +- gcc/testsuite/gcc.dg/gomp/nesting-1.c | 64 ++++++------- .../gfortran.dg/gomp/appendix-a/a.35.1.f90 | 2 +- .../gfortran.dg/gomp/appendix-a/a.35.3.f90 | 2 +- .../gfortran.dg/gomp/appendix-a/a.35.4.f90 | 2 +- .../gfortran.dg/gomp/appendix-a/a.35.6.f90 | 2 +- libgomp/ChangeLog | 11 +++ libgomp/testsuite/libgomp.c/pr26943-2.c | 5 +- libgomp/testsuite/libgomp.c/pr26943-3.c | 5 +- libgomp/testsuite/libgomp.c/pr26943-4.c | 5 +- libgomp/testsuite/libgomp.fortran/vla4.f90 | 6 +- libgomp/testsuite/libgomp.fortran/vla5.f90 | 6 +- 16 files changed, 168 insertions(+), 86 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr53580.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe6a26e4049..ee090d62965 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2012-06-07 Jakub Jelinek + + PR middle-end/53580 + * omp-low.c (scan_omp): Change first argument to + gimple_seq *, call walk_gimple_seq_mod instead of + walk_gimple_seq. + (scan_sharing_clauses, scan_omp_parallel, scan_omp_task, + scan_omp_for, scan_omp_sections, scan_omp_single, + execute_lower_omp): Adjust callers. + (scan_omp_1_stmt): Likewise. If check_omp_nesting_restrictions + returns false, replace stmt with GIMPLE_NOP. + (check_omp_nesting_restrictions): Instead of issuing warnings, + issue errors and return false if any errors were reported. + 2012-06-06 Steven Bosscher * doc/invoke.texi (fconserve-space): Remove documentation. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 00584725ab1..d51715e2843 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -131,7 +131,7 @@ static int taskreg_nesting_level; struct omp_region *root_omp_region; static bitmap task_shared_vars; -static void scan_omp (gimple_seq, omp_context *); +static void scan_omp (gimple_seq *, omp_context *); static tree scan_omp_1_op (tree *, int *, void *); #define WALK_SUBSTMTS \ @@ -1533,12 +1533,12 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c)) { - scan_omp (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx); - scan_omp (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx); + scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c), ctx); + scan_omp (&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c), ctx); } else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)) - scan_omp (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx); + scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx); } /* Create a new name for omp child function. Returns an identifier. */ @@ -1663,7 +1663,7 @@ scan_omp_parallel (gimple_stmt_iterator *gsi, omp_context *outer_ctx) gimple_omp_parallel_set_child_fn (stmt, ctx->cb.dst_fn); scan_sharing_clauses (gimple_omp_parallel_clauses (stmt), ctx); - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); if (TYPE_FIELDS (ctx->record_type) == NULL) ctx->record_type = ctx->receiver_decl = NULL; @@ -1720,7 +1720,7 @@ scan_omp_task (gimple_stmt_iterator *gsi, omp_context *outer_ctx) create_omp_child_function (ctx, true); } - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); if (TYPE_FIELDS (ctx->record_type) == NULL) { @@ -1773,7 +1773,7 @@ scan_omp_for (gimple stmt, omp_context *outer_ctx) scan_sharing_clauses (gimple_omp_for_clauses (stmt), ctx); - scan_omp (gimple_omp_for_pre_body (stmt), ctx); + scan_omp (gimple_omp_for_pre_body_ptr (stmt), ctx); for (i = 0; i < gimple_omp_for_collapse (stmt); i++) { scan_omp_op (gimple_omp_for_index_ptr (stmt, i), ctx); @@ -1781,7 +1781,7 @@ scan_omp_for (gimple stmt, omp_context *outer_ctx) scan_omp_op (gimple_omp_for_final_ptr (stmt, i), ctx); scan_omp_op (gimple_omp_for_incr_ptr (stmt, i), ctx); } - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); } /* Scan an OpenMP sections directive. */ @@ -1793,7 +1793,7 @@ scan_omp_sections (gimple stmt, omp_context *outer_ctx) ctx = new_omp_context (stmt, outer_ctx); scan_sharing_clauses (gimple_omp_sections_clauses (stmt), ctx); - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); } /* Scan an OpenMP single directive. */ @@ -1813,7 +1813,7 @@ scan_omp_single (gimple stmt, omp_context *outer_ctx) TYPE_NAME (ctx->record_type) = name; scan_sharing_clauses (gimple_omp_single_clauses (stmt), ctx); - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); if (TYPE_FIELDS (ctx->record_type) == NULL) ctx->record_type = NULL; @@ -1823,8 +1823,8 @@ scan_omp_single (gimple stmt, omp_context *outer_ctx) /* Check OpenMP nesting restrictions. */ -static void -check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) +static bool +check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) { switch (gimple_code (stmt)) { @@ -1843,17 +1843,19 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) case GIMPLE_OMP_TASK: if (is_gimple_call (stmt)) { - warning (0, "barrier region may not be closely nested inside " - "of work-sharing, critical, ordered, master or " - "explicit task region"); - return; + error_at (gimple_location (stmt), + "barrier region may not be closely nested inside " + "of work-sharing, critical, ordered, master or " + "explicit task region"); + return false; } - warning (0, "work-sharing region may not be closely nested inside " - "of work-sharing, critical, ordered, master or explicit " - "task region"); - return; + error_at (gimple_location (stmt), + "work-sharing region may not be closely nested inside " + "of work-sharing, critical, ordered, master or explicit " + "task region"); + return false; case GIMPLE_OMP_PARALLEL: - return; + return true; default: break; } @@ -1866,11 +1868,12 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) case GIMPLE_OMP_SECTIONS: case GIMPLE_OMP_SINGLE: case GIMPLE_OMP_TASK: - warning (0, "master region may not be closely nested inside " - "of work-sharing or explicit task region"); - return; + error_at (gimple_location (stmt), + "master region may not be closely nested inside " + "of work-sharing or explicit task region"); + return false; case GIMPLE_OMP_PARALLEL: - return; + return true; default: break; } @@ -1881,17 +1884,22 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) { case GIMPLE_OMP_CRITICAL: case GIMPLE_OMP_TASK: - warning (0, "ordered region may not be closely nested inside " - "of critical or explicit task region"); - return; + error_at (gimple_location (stmt), + "ordered region may not be closely nested inside " + "of critical or explicit task region"); + return false; case GIMPLE_OMP_FOR: if (find_omp_clause (gimple_omp_for_clauses (ctx->stmt), OMP_CLAUSE_ORDERED) == NULL) - warning (0, "ordered region must be closely nested inside " + { + error_at (gimple_location (stmt), + "ordered region must be closely nested inside " "a loop region with an ordered clause"); - return; + return false; + } + return true; case GIMPLE_OMP_PARALLEL: - return; + return true; default: break; } @@ -1902,14 +1910,16 @@ check_omp_nesting_restrictions (gimple stmt, omp_context *ctx) && (gimple_omp_critical_name (stmt) == gimple_omp_critical_name (ctx->stmt))) { - warning (0, "critical region may not be nested inside a critical " - "region with the same name"); - return; + error_at (gimple_location (stmt), + "critical region may not be nested inside a critical " + "region with the same name"); + return false; } break; default: break; } + return true; } @@ -1980,14 +1990,20 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, /* Check the OpenMP nesting restrictions. */ if (ctx != NULL) { + bool remove = false; if (is_gimple_omp (stmt)) - check_omp_nesting_restrictions (stmt, ctx); + remove = !check_omp_nesting_restrictions (stmt, ctx); else if (is_gimple_call (stmt)) { tree fndecl = gimple_call_fndecl (stmt); if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_GOMP_BARRIER) - check_omp_nesting_restrictions (stmt, ctx); + remove = !check_omp_nesting_restrictions (stmt, ctx); + } + if (remove) + { + stmt = gimple_build_nop (); + gsi_replace (gsi, stmt, false); } } @@ -2024,7 +2040,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, case GIMPLE_OMP_ORDERED: case GIMPLE_OMP_CRITICAL: ctx = new_omp_context (stmt, ctx); - scan_omp (gimple_omp_body (stmt), ctx); + scan_omp (gimple_omp_body_ptr (stmt), ctx); break; case GIMPLE_BIND: @@ -2051,7 +2067,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, clauses found during the scan. */ static void -scan_omp (gimple_seq body, omp_context *ctx) +scan_omp (gimple_seq *body_p, omp_context *ctx) { location_t saved_location; struct walk_stmt_info wi; @@ -2061,7 +2077,7 @@ scan_omp (gimple_seq body, omp_context *ctx) wi.want_locations = true; saved_location = input_location; - walk_gimple_seq (body, scan_omp_1_stmt, scan_omp_1_op, &wi); + walk_gimple_seq_mod (body_p, scan_omp_1_stmt, scan_omp_1_op, &wi); input_location = saved_location; } @@ -6919,7 +6935,7 @@ execute_lower_omp (void) delete_omp_context); body = gimple_body (current_function_decl); - scan_omp (body, NULL); + scan_omp (&body, NULL); gcc_assert (taskreg_nesting_level == 0); if (all_contexts->root) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 42fcf829444..2ba217fc40c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2012-06-07 Jakub Jelinek + + PR middle-end/53580 + * gcc.dg/gomp/nesting-1.c: Expect errors rather than warnings. + * gcc.dg/gomp/critical-4.c: Likewise. + * gfortran.dg/gomp/appendix-a/a.35.1.f90: Likewise. + * gfortran.dg/gomp/appendix-a/a.35.3.f90: Likewise. + * gfortran.dg/gomp/appendix-a/a.35.4.f90: Likewise. + * gfortran.dg/gomp/appendix-a/a.35.6.f90: Likewise. + * c-c++-common/gomp/pr53580.c: New test. + 2012-06-07 Fabien ChĂȘne PR c++/51214 diff --git a/gcc/testsuite/c-c++-common/gomp/pr53580.c b/gcc/testsuite/c-c++-common/gomp/pr53580.c new file mode 100644 index 00000000000..941a90d2240 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr53580.c @@ -0,0 +1,19 @@ +/* PR middle-end/53580 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +main () +{ + int x, y, v = 0; + +#pragma omp parallel + #pragma omp for + for (x = 0; x < 10; x++) + { + #pragma omp for reduction(+: v) /* { dg-error "work-sharing region may not be closely nested inside of work-sharing" } */ + for (y = 0; y < 10; y++) + v++; + } + return v - 100; +} diff --git a/gcc/testsuite/gcc.dg/gomp/critical-4.c b/gcc/testsuite/gcc.dg/gomp/critical-4.c index 530e7c976fc..8d4f6a79180 100644 --- a/gcc/testsuite/gcc.dg/gomp/critical-4.c +++ b/gcc/testsuite/gcc.dg/gomp/critical-4.c @@ -15,7 +15,7 @@ void foo2 (void) { #pragma omp critical - #pragma omp critical /* { dg-warning "with the same name" } */ + #pragma omp critical /* { dg-error "with the same name" } */ bar (0); } @@ -23,6 +23,6 @@ void foo3 (void) { #pragma omp critical(foo) - #pragma omp critical(foo) /* { dg-warning "with the same name" } */ + #pragma omp critical(foo) /* { dg-error "with the same name" } */ bar (0); } diff --git a/gcc/testsuite/gcc.dg/gomp/nesting-1.c b/gcc/testsuite/gcc.dg/gomp/nesting-1.c index 6f27b907e6b..df57ac845f7 100644 --- a/gcc/testsuite/gcc.dg/gomp/nesting-1.c +++ b/gcc/testsuite/gcc.dg/gomp/nesting-1.c @@ -8,89 +8,89 @@ f1 (void) #pragma omp for for (i = 0; i < 3; i++) { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; - #pragma omp master /* { dg-warning "may not be closely nested" } */ + #pragma omp master /* { dg-error "may not be closely nested" } */ ; - #pragma omp barrier /* { dg-warning "may not be closely nested" } */ + #pragma omp barrier /* { dg-error "may not be closely nested" } */ } #pragma omp sections { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; - #pragma omp master /* { dg-warning "may not be closely nested" } */ + #pragma omp master /* { dg-error "may not be closely nested" } */ ; #pragma omp section ; } #pragma omp single { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; - #pragma omp master /* { dg-warning "may not be closely nested" } */ + #pragma omp master /* { dg-error "may not be closely nested" } */ ; - #pragma omp barrier /* { dg-warning "may not be closely nested" } */ + #pragma omp barrier /* { dg-error "may not be closely nested" } */ } #pragma omp master { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; #pragma omp master ; - #pragma omp barrier /* { dg-warning "may not be closely nested" } */ + #pragma omp barrier /* { dg-error "may not be closely nested" } */ } #pragma omp task { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; - #pragma omp master /* { dg-warning "may not be closely nested" } */ + #pragma omp master /* { dg-error "may not be closely nested" } */ ; - #pragma omp barrier /* { dg-warning "may not be closely nested" } */ + #pragma omp barrier /* { dg-error "may not be closely nested" } */ } #pragma omp parallel { @@ -117,20 +117,20 @@ f2 (void) int i, j; #pragma omp ordered { - #pragma omp for /* { dg-warning "may not be closely nested" } */ + #pragma omp for /* { dg-error "may not be closely nested" } */ for (j = 0; j < 3; j++) ; - #pragma omp sections /* { dg-warning "may not be closely nested" } */ + #pragma omp sections /* { dg-error "may not be closely nested" } */ { ; #pragma omp section ; } - #pragma omp single /* { dg-warning "may not be closely nested" } */ + #pragma omp single /* { dg-error "may not be closely nested" } */ ; #pragma omp master ; - #pragma omp barrier /* { dg-warning "may not be closely nested" } */ + #pragma omp barrier /* { dg-error "may not be closely nested" } */ } } @@ -139,7 +139,7 @@ f3 (void) { #pragma omp critical { - #pragma omp ordered /* { dg-warning "may not be closely nested" } */ + #pragma omp ordered /* { dg-error "may not be closely nested" } */ ; } } @@ -149,7 +149,7 @@ f4 (void) { #pragma omp task { - #pragma omp ordered /* { dg-warning "may not be closely nested" } */ + #pragma omp ordered /* { dg-error "may not be closely nested" } */ ; } } @@ -161,7 +161,7 @@ f5 (void) #pragma omp for for (i = 0; i < 10; i++) { - #pragma omp ordered /* { dg-warning "must be closely nested" } */ + #pragma omp ordered /* { dg-error "must be closely nested" } */ ; } #pragma omp for ordered @@ -190,9 +190,9 @@ f7 (void) #pragma omp critical ; #pragma omp critical (bar) - #pragma omp critical (bar) /* { dg-warning "may not be nested" } */ + #pragma omp critical (bar) /* { dg-error "may not be nested" } */ ; #pragma omp critical - #pragma omp critical /* { dg-warning "may not be nested" } */ + #pragma omp critical /* { dg-error "may not be nested" } */ ; } diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.1.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.1.f90 index 7431a6579c3..71886814ee4 100644 --- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.1.f90 @@ -10,7 +10,7 @@ !$OMP DO DO I = 1, N ! incorrect nesting of loop regions -!$OMP DO ! { dg-warning "may not be closely nested" } +!$OMP DO ! { dg-error "may not be closely nested" } DO J = 1, N CALL WORK(I,J) END DO diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.3.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.3.f90 index bb3e02fefd9..160302a2b17 100644 --- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.3.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.3.f90 @@ -7,7 +7,7 @@ !$OMP DO DO I = 1, N ! incorrect nesting of regions -!$OMP SINGLE ! { dg-warning "may not be closely nested" } +!$OMP SINGLE ! { dg-error "may not be closely nested" } CALL WORK(I, 1) !$OMP END SINGLE END DO diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.4.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.4.f90 index f130dd5f480..40cf9b92ca5 100644 --- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.4.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.4.f90 @@ -8,7 +8,7 @@ DO I = 1, N CALL WORK(I, 1) ! incorrect nesting of barrier region in a loop region -!$OMP BARRIER ! { dg-warning "may not be closely nested" } +!$OMP BARRIER ! { dg-error "may not be closely nested" } CALL WORK(I, 2) END DO !$OMP END PARALLEL diff --git a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.6.f90 b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.6.f90 index 62ba245236b..5b94c891dfe 100644 --- a/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.6.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/appendix-a/a.35.6.f90 @@ -6,7 +6,7 @@ !$OMP SINGLE CALL WORK(N,1) ! incorrect nesting of barrier region in a single region -!$OMP BARRIER ! { dg-warning "may not be closely nested" } +!$OMP BARRIER ! { dg-error "may not be closely nested" } CALL WORK(N,2) !$OMP END SINGLE !$OMP END PARALLEL diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f22c41a728f..df2bfb50450 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,14 @@ +2012-06-07 Jakub Jelinek + + PR middle-end/53580 + * testsuite/libgomp.c/pr26943-2.c: Remove #pragma omp barrier, + use GOMP_barrier () call instead. + * testsuite/libgomp.c/pr26943-3.c: Likewise. + * testsuite/libgomp.c/pr26943-4.c: Likewise. + * testsuite/libgomp.fortran/vla4.f90: Remove !$omp barrier, + call GOMP_barrier instead. + * testsuite/libgomp.fortran/vla5.f90: Likewise. + 2012-06-06 Jakub Jelinek PR libgomp/52993 diff --git a/libgomp/testsuite/libgomp.c/pr26943-2.c b/libgomp/testsuite/libgomp.c/pr26943-2.c index c052e811288..2ed21ae963e 100644 --- a/libgomp/testsuite/libgomp.c/pr26943-2.c +++ b/libgomp/testsuite/libgomp.c/pr26943-2.c @@ -3,6 +3,7 @@ extern int omp_set_dynamic (int); extern void abort (void); +extern void GOMP_barrier (void); int a = 8, b = 12, c = 16, d = 20, j = 0; char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d"; @@ -20,7 +21,7 @@ main (void) { if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b') j++; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); #pragma omp atomic a += i; b += i; @@ -31,7 +32,7 @@ main (void) f[0] += i; g[0] = 'g' + i; h[0] = 'h' + i; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); if (a != 8 + 6 || b != 12 + i || c != i || d != i) j += 8; if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i) diff --git a/libgomp/testsuite/libgomp.c/pr26943-3.c b/libgomp/testsuite/libgomp.c/pr26943-3.c index dc3d5010da1..855a4b27446 100644 --- a/libgomp/testsuite/libgomp.c/pr26943-3.c +++ b/libgomp/testsuite/libgomp.c/pr26943-3.c @@ -4,6 +4,7 @@ extern int omp_set_dynamic (int); extern int omp_get_thread_num (void); extern void abort (void); +extern void GOMP_barrier (void); int a = 8, b = 12, c = 16, d = 20, j = 0, l = 0; char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d"; @@ -26,7 +27,7 @@ main (void) { if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b') j++; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); #pragma omp atomic a += i; b += i; @@ -37,7 +38,7 @@ main (void) f[0] += i; g[0] = 'g' + i; h[0] = 'h' + i; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); if (a != 8 + 6 || b != 12 + i || c != i || d != i) j += 8; if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i) diff --git a/libgomp/testsuite/libgomp.c/pr26943-4.c b/libgomp/testsuite/libgomp.c/pr26943-4.c index 0f1d4197a5f..24f253d236d 100644 --- a/libgomp/testsuite/libgomp.c/pr26943-4.c +++ b/libgomp/testsuite/libgomp.c/pr26943-4.c @@ -4,6 +4,7 @@ extern int omp_set_dynamic (int); extern int omp_get_thread_num (void); extern void abort (void); +extern void GOMP_barrier (void); int a = 8, b = 12, c = 16, d = 20, j = 0, l = 0; char e[10] = "a", f[10] = "b", g[10] = "c", h[10] = "d"; @@ -27,7 +28,7 @@ main (void) { if (a != 8 || b != 12 || e[0] != 'a' || f[0] != 'b') j++; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); #pragma omp atomic a += i; b += i; @@ -38,7 +39,7 @@ main (void) f[0] += i; g[0] = 'g' + i; h[0] = 'h' + i; -#pragma omp barrier /* { dg-warning "may not be closely nested" } */ + GOMP_barrier (); if (a != 8 + 6 || b != 12 + i || c != i || d != i) j += 8; if (e[0] != 'a' + 6 || f[0] != 'b' + i || g[0] != 'g' + i) diff --git a/libgomp/testsuite/libgomp.fortran/vla4.f90 b/libgomp/testsuite/libgomp.fortran/vla4.f90 index cdd4849b6ad..0bee30cf817 100644 --- a/libgomp/testsuite/libgomp.fortran/vla4.f90 +++ b/libgomp/testsuite/libgomp.fortran/vla4.f90 @@ -10,6 +10,10 @@ contains subroutine foo (c, d, e, f, g, h, i, j, k, n) use omp_lib + interface + subroutine GOMP_barrier () bind(c, name="GOMP_barrier") + end subroutine + end interface integer :: n character (len = *) :: c character (len = n) :: d @@ -94,7 +98,7 @@ contains forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - x - p + q - 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = w(1:7) forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = w(20:26) -!$omp barrier ! { dg-warning "may not be closely nested" } + call GOMP_barrier y = '' if (x .eq. 0) y = '0' if (x .eq. 1) y = '1' diff --git a/libgomp/testsuite/libgomp.fortran/vla5.f90 b/libgomp/testsuite/libgomp.fortran/vla5.f90 index 9b611505219..cdd561d3961 100644 --- a/libgomp/testsuite/libgomp.fortran/vla5.f90 +++ b/libgomp/testsuite/libgomp.fortran/vla5.f90 @@ -10,6 +10,10 @@ contains subroutine foo (c, d, e, f, g, h, i, j, k, n) use omp_lib + interface + subroutine GOMP_barrier () bind(c, name="GOMP_barrier") + end subroutine + end interface integer :: n character (len = *) :: c character (len = n) :: d @@ -66,7 +70,7 @@ contains forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - x - p + q - 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = w(1:7) forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = w(20:26) -!$omp barrier ! { dg-warning "may not be closely nested" } + call GOMP_barrier y = '' if (x .eq. 0) y = '0' if (x .eq. 1) y = '1'