]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
OpenMP: Fix for ICE in tree-nested.cc.
authorSandra Loosemore <sloosemore@baylibre.com>
Mon, 22 Apr 2024 18:24:25 +0000 (18:24 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Mon, 6 May 2024 14:37:14 +0000 (14:37 +0000)
Use gimple_omp_target_clauses() instead of gimple_omp_taskreg_clauses()
when stmt is GIMPLE_OMP_TARGET, to avoid an as_a<> ICE.  The code
immediately following this is already conditionalized in the same way.

gcc/ChangeLog
* tree-nested.cc (convert_tramp_reference_stmt): Use the correct
accessor for GIMPLE_OMP_TARGET clauses.

gcc/tree-nested.cc

index 4e5f3be76767e53fe52e5b4abbec60865a1f893e..fc0495d644315d4cc021c9cfe8b3cc962630aa6d 100644 (file)
@@ -2906,9 +2906,11 @@ convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
              continue;
            decl = i ? get_chain_decl (info) : info->frame_decl;
            /* Don't add CHAIN.* or FRAME.* twice.  */
-           for (c = gimple_omp_taskreg_clauses (stmt);
-                c;
-                c = OMP_CLAUSE_CHAIN (c))
+           if (gimple_code (stmt) == GIMPLE_OMP_TARGET)
+             c = gimple_omp_target_clauses (stmt);
+           else
+             c = gimple_omp_taskreg_clauses (stmt);
+           for (; c; c = OMP_CLAUSE_CHAIN (c))
              if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
                   || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED)
                  && OMP_CLAUSE_DECL (c) == decl)