This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Introduce warning -Womp-default-scope
- From: "VandeVondele Joost" <joost dot vandevondele at mat dot ethz dot ch>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 23 Sep 2014 15:05:29 +0000
- Subject: RE: [PATCH] Introduce warning -Womp-default-scope
- Authentication-results: sourceware.org; auth=none
- References: <908103EDB4893A42920B21D3568BFD9315107BAB at MBX13 dot d dot ethz dot ch>,<20140923144012 dot GO17454 at tucnak dot redhat dot com>
> a) I don't like the option name, -Womp-no-default-clause would be IMHO better
a bit related to b), I first had -Womp-no-default-none-clause but it becomes long and contains twice 'no' (also consider the no-omp-no-default... form).
If you like that more, I'll make that change (see below) otherwise I retain the current form.
> b) I think you shouldn't warn for explicit default(shared), or
> default(firstprivate) or default(private) clauses, there user explicitly
> tells what should happen for the non-listed vars (and it is pretty rare)
I would still like to warn for those, default(shared) is equivalent to just leaving it out, and unfortunately, I have observed bugs with explicit default(shared/private). Usually caused by people updating code in large parallel sections, not realizing that they are in an OMP region. This is essentially what I would like to catch and to (effectively) enforce default(none). It is somewhat similar to the -fimplicit-none option in the Fortran FE.
> c) in the documentation I think you should make it clear that it is just a
> coding style warning (dunno if we have some verbiage for such warnings)
Like so (and associated code/test changes) ?
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-no-default-none-clause
+Common Var(warn_omp_no_default_none_clause) Warning
+Warn for error-prone code style in which 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