This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Attached patch introduces an optional warning for an OMP parallel/task/teams construct without explicit default(none). This would effectively catch the number one reason of easy-to-avoid OMP bugs in our project. Tested with check-fortran, full bootstrap & check in progress. OK for trunk if this passes ? Joost
Index: gcc/testsuite/gfortran.dg/gomp/omp-default-scope.f90 =================================================================== --- gcc/testsuite/gfortran.dg/gomp/omp-default-scope.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/gomp/omp-default-scope.f90 (revision 0) @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-options "-fopenmp -Womp-default-scope" } + SUBROUTINE S1(d) + IMPLICIT NONE + INTEGER :: i,d(*),c + !$OMP PARALLEL DO ! { dg-warning "construct without explicit" } + DO i=1,100 + c= d(i) + d(i)=c*c + ENDDO + END SUBROUTINE S1 Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 215323) +++ gcc/gimplify.c (working copy) @@ -6255,6 +6255,13 @@ gimplify_scan_omp_clauses (tree *list_p, list_p = &OMP_CLAUSE_CHAIN (c); } + if (ctx->default_kind != OMP_CLAUSE_DEFAULT_NONE + && (ctx->region_type & ORT_PARALLEL + || ctx->region_type & ORT_TASK + || ctx->region_type == ORT_TEAMS)) + warning_at (ctx->location, OPT_Womp_default_scope, + "OMP parallel/task/teams construct without explicit default(none)"); + gimplify_omp_ctxp = ctx; } Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 215323) +++ gcc/common.opt (working copy) @@ -591,6 +591,10 @@ Wodr Common Var(warn_odr_violations) Init(1) Warning Warn about some C++ One Definition Rule violations during link time optimization +Womp-default-scope +Common Var(warn_omp_default_scope) Warning +Warn if an OMP parallel/task/teams construct has no explicit default(none) clause. + Woverflow Common Var(warn_overflow) Init(1) Warning Warn about overflow in arithmetic expressions
Attachment:
patch-warn-omp-default-scope_v01-CL.txt
Description: patch-warn-omp-default-scope_v01-CL.txt
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |