diff mbox

[PR,middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c

Message ID 87mvmpoxd0.fsf@hertz.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge June 13, 2016, 4:40 p.m. UTC
Hi!

On Mon, 13 Jun 2016 16:48:56 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Jun 13, 2016 at 04:43:25PM +0200, Thomas Schwinge wrote:
> > On Wed, 01 Jun 2016 17:06:42 +0200, Thomas Schwinge <thomas@codesourcery.com> wrote:
> > > Here are the OpenACC bits of <http://gcc.gnu.org/PR71373>.
> > 
> > In the PR, Jakub clarified that all the missing other OMP_CLAUSE_* are in
> > fact all unreachable here.

> > The "anything else" default case in fact now is just the non-clause
> > OMP_CLAUSE_ERROR, so when adding a case for that one, we could then
> > remove the default case, and thus get a compiler warning when new clauses
> > are added in the future, without handling them here.  That makes sense to
> > me (would have made apparent much earlier the original problem of missing
> > handling for certain OMP_CLAUSE_*), but based on feedback received, it
> > feels as if I'm the only supporter of such "defensive" programming
> > paradigms?

Any thoughts about that,
<http://news.gmane.org/find-root.php?message_id=%3C874m8xqh5w.fsf%40hertz.schwinge.homeip.net%3E>?

> >     [PR middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c

> Ok, [...]

As posted, committed to trunk in r237386:

commit be2a5a8e8ffd13c099d372c4fcc363d5cd3c83c2
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Jun 13 16:37:29 2016 +0000

    [PR middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c
    
    	gcc/
    	PR middle-end/71373
    	* tree-nested.c (convert_nonlocal_omp_clauses)
    	(convert_local_omp_clauses): Document missing OMP_CLAUSE_*.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237386 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog     |  4 ++++
 gcc/tree-nested.c | 60 ++++++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 46 insertions(+), 18 deletions(-)



Grüße
 Thomas
diff mbox

Patch

diff --git gcc/ChangeLog gcc/ChangeLog
index ff685b1..89098e7 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,5 +1,9 @@ 
 2016-06-13  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR middle-end/71373
+	* tree-nested.c (convert_nonlocal_omp_clauses)
+	(convert_local_omp_clauses): Document missing OMP_CLAUSE_*.
+
 	* tree-cfg.c (edge_to_cases_cleanup): Fix CASE_CHAIN typo.
 	* tree.def (CASE_LABEL_EXPR): Likewise.
 
diff --git gcc/tree-nested.c gcc/tree-nested.c
index 812f619..62cb01f 100644
--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -1203,17 +1203,29 @@  convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE_AUTO:
 	  break;
 
+	  /* OpenACC tile clauses are discarded during gimplification.  */
 	case OMP_CLAUSE_TILE:
-	  /* OpenACC tile clauses are discarded during gimplification, so we
-	     don't expect to see anything here.  */
-	  gcc_unreachable ();
-
+	  /* The following clause belongs to the OpenACC cache directive, which
+	     is discarded during gimplification.  */
 	case OMP_CLAUSE__CACHE_:
-	  /* These clauses belong to the OpenACC cache directive, which is
-	     discarded during gimplification, so we don't expect to see
-	     anything here.  */
-	  gcc_unreachable ();
-
+	  /* The following clauses are only allowed in the OpenMP declare simd
+	     directive, so not seen here.  */
+	case OMP_CLAUSE_UNIFORM:
+	case OMP_CLAUSE_INBRANCH:
+	case OMP_CLAUSE_NOTINBRANCH:
+	  /* The following clauses are only allowed on OpenMP cancel and
+	     cancellation point directives, which at this point have already
+	     been lowered into a function call.  */
+	case OMP_CLAUSE_FOR:
+	case OMP_CLAUSE_PARALLEL:
+	case OMP_CLAUSE_SECTIONS:
+	case OMP_CLAUSE_TASKGROUP:
+	  /* The following clauses are only added during OMP lowering; nested
+	     function decomposition happens before that.  */
+	case OMP_CLAUSE__LOOPTEMP_:
+	case OMP_CLAUSE__SIMDUID_:
+	case OMP_CLAUSE__GRIDDIM_:
+	  /* Anything else.  */
 	default:
 	  gcc_unreachable ();
 	}
@@ -1899,17 +1911,29 @@  convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE_AUTO:
 	  break;
 
+	  /* OpenACC tile clauses are discarded during gimplification.  */
 	case OMP_CLAUSE_TILE:
-	  /* OpenACC tile clauses are discarded during gimplification, so we
-	     don't expect to see anything here.  */
-	  gcc_unreachable ();
-
+	  /* The following clause belongs to the OpenACC cache directive, which
+	     is discarded during gimplification.  */
 	case OMP_CLAUSE__CACHE_:
-	  /* These clauses belong to the OpenACC cache directive, which is
-	     discarded during gimplification, so we don't expect to see
-	     anything here.  */
-	  gcc_unreachable ();
-
+	  /* The following clauses are only allowed in the OpenMP declare simd
+	     directive, so not seen here.  */
+	case OMP_CLAUSE_UNIFORM:
+	case OMP_CLAUSE_INBRANCH:
+	case OMP_CLAUSE_NOTINBRANCH:
+	  /* The following clauses are only allowed on OpenMP cancel and
+	     cancellation point directives, which at this point have already
+	     been lowered into a function call.  */
+	case OMP_CLAUSE_FOR:
+	case OMP_CLAUSE_PARALLEL:
+	case OMP_CLAUSE_SECTIONS:
+	case OMP_CLAUSE_TASKGROUP:
+	  /* The following clauses are only added during OMP lowering; nested
+	     function decomposition happens before that.  */
+	case OMP_CLAUSE__LOOPTEMP_:
+	case OMP_CLAUSE__SIMDUID_:
+	case OMP_CLAUSE__GRIDDIM_:
+	  /* Anything else.  */
 	default:
 	  gcc_unreachable ();
 	}