]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cp/semantics.c
Make OpenACC orphan gang reductions errors
[thirdparty/gcc.git] / gcc / cp / semantics.c
index cd1956497f8cfe0e60034d7b802ee6a7fb1e81c8..c84caf432517b0d8da106a7fe922085d3a259f96 100644 (file)
@@ -6667,6 +6667,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          field_ok = ((ort & C_ORT_OMP_DECLARE_SIMD) == C_ORT_OMP);
          goto check_dup_generic;
        case OMP_CLAUSE_REDUCTION:
+         if (ort == C_ORT_ACC && oacc_get_fn_attrib (current_function_decl)
+             && omp_find_clause (clauses, OMP_CLAUSE_GANG))
+           {
+             error_at (OMP_CLAUSE_LOCATION (c),
+                       "gang reduction on an orphan loop");
+             remove = true;
+             break;
+           }
          if (reduction_seen == 0)
            reduction_seen = OMP_CLAUSE_REDUCTION_INSCAN (c) ? -1 : 1;
          else if (reduction_seen != -2