From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>

        gcc/
        * omp-low.c (scan_sharing_clauses): Catch unexpected occurrences
        of OMP_CLAUSE_TO, OMP_CLAUSE_FROM, OMP_CLAUSE_MAP.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@208015 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp |  3 +++
 gcc/omp-low.c      | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index bf8ec96..bd46f2e 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2014-02-21  Thomas Schwinge  <tho...@codesourcery.com>
 
+       * omp-low.c (scan_sharing_clauses): Catch unexpected occurrences
+       of OMP_CLAUSE_TO, OMP_CLAUSE_FROM, OMP_CLAUSE_MAP.
+
        * gimplify.c (enum omp_region_type): Make ORT_TARGET_OFFLOAD a
        flag for ORT_TARGET, in its negation replacing ORT_TARGET_DATA.
        Update all users.
diff --git gcc/omp-low.c gcc/omp-low.c
index 9fef4c1..bca4599 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -1630,6 +1630,26 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
        case OMP_CLAUSE_FROM:
          gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt));
        case OMP_CLAUSE_MAP:
+         switch (OMP_CLAUSE_CODE (c))
+           {
+           case OMP_CLAUSE_TO:
+           case OMP_CLAUSE_FROM:
+             /* The to and from clauses are only ever seen with OpenMP target
+                update constructs.  */
+             gcc_assert (gimple_code (ctx->stmt) == GIMPLE_OMP_TARGET
+                         && (gimple_omp_target_kind (ctx->stmt)
+                             == GF_OMP_TARGET_KIND_UPDATE));
+             break;
+           case OMP_CLAUSE_MAP:
+             /* The map clause is never seen with OpenMP target update
+                constructs.  */
+             gcc_assert (gimple_code (ctx->stmt) != GIMPLE_OMP_TARGET
+                         || (gimple_omp_target_kind (ctx->stmt)
+                             != GF_OMP_TARGET_KIND_UPDATE));
+             break;
+           default:
+             gcc_unreachable ();
+           }
          if (ctx->outer)
            scan_omp_op (&OMP_CLAUSE_SIZE (c), ctx->outer);
          decl = OMP_CLAUSE_DECL (c);
@@ -1799,6 +1819,11 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
          break;
 
        case OMP_CLAUSE_MAP:
+         /* The map clause is never seen with OpenMP target update
+            constructs.  */
+         gcc_assert (gimple_code (ctx->stmt) != GIMPLE_OMP_TARGET
+                     || (gimple_omp_target_kind (ctx->stmt)
+                         != GF_OMP_TARGET_KIND_UPDATE));
          if (!gimple_code_is_oacc (ctx->stmt)
              && gimple_omp_target_kind (ctx->stmt) == GF_OMP_TARGET_KIND_DATA)
            break;
-- 
1.8.1.1

Reply via email to