[gcc/devel/omp/gcc-14] OpenMP: Fix for ICE in tree-nested.cc.

Paul-Antoine Arras parras@gcc.gnu.org
Fri Jun 28 09:56:41 GMT 2024


https://gcc.gnu.org/g:fbf246fb92aa4688a4fae0681c86716437bff4e1

commit fbf246fb92aa4688a4fae0681c86716437bff4e1
Author: Sandra Loosemore <sloosemore@baylibre.com>
Date:   Mon Apr 22 18:24:25 2024 +0000

    OpenMP: Fix for ICE in tree-nested.cc.
    
    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.

Diff:
---
 gcc/ChangeLog.omp  | 5 +++++
 gcc/tree-nested.cc | 8 +++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index e95ec6a43e2..2ad1324cba1 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2024-04-22  Sandra Loosemore  <sloosemore@baylibre.com>
+
+	* tree-nested.cc (convert_tramp_reference_stmt): Use the correct
+	accessor for GIMPLE_OMP_TARGET clauses.
+
 2024-05-04  Sandra Loosemore  <sloosemore@baylibre.com>
 
 	* omp-general.cc (omp_complete_construct_context): Check
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index b13c036e2b0..753163189a3 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -2908,9 +2908,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)


More information about the Gcc-cvs mailing list