[gcc/devel/omp/gcc-16] GCN: Implement 'TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID' [PR101484]

Sandra Loosemore via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:e9ee0bf52c700c68fe94f0906e0909b257907415

commit e9ee0bf52c700c68fe94f0906e0909b257907415
Author: Thomas Schwinge <[email protected]>
Date:   Thu Jun 11 21:41:10 2026 +0200

    GCN: Implement 'TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID' [PR101484]
    
    This is the proper fix to replace
    commit 9f2bc5077debef2b046b6c10d38591ac324ad8b5
    "[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]",
    commit 8168338684fc2bed576bb09202c63b3e9e678d92
    "[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' some more [PR101484]".
    
            PR target/101484
            gcc/
            * config/gcn/gcn.cc (TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID): Implement.
            libgomp/
            * configure.tgt [GCN] (XCFLAGS): Don't add '-Wno-error=array-bounds'.
    
    (cherry picked from commit 9e2d90074db033be5544d97f03c7d80e5623af25)

Diff:
---
 gcc/config/gcn/gcn.cc | 10 ++++++++++
 libgomp/configure.tgt |  3 ---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 4ba767c6951c..9e7907cfaf35 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -1874,6 +1874,14 @@ gcn_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
   return false;
 }
 
+static bool
+gcn_addr_space_zero_address_valid (addr_space_t as)
+{
+  if (as == ADDR_SPACE_LDS)
+    return true;
+  return false;
+}
+
 static addr_space_t
 gcn_addr_space_resolve_default (addr_space_t as)
 {
@@ -8085,6 +8093,8 @@ gcn_dwarf_register_span (rtx rtl)
 #define TARGET_ADDR_SPACE_POINTER_MODE gcn_addr_space_pointer_mode
 #undef  TARGET_ADDR_SPACE_SUBSET_P
 #define TARGET_ADDR_SPACE_SUBSET_P gcn_addr_space_subset_p
+#undef  TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
+#define TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID gcn_addr_space_zero_address_valid
 #undef  TARGET_ADDR_SPACE_CONVERT
 #define TARGET_ADDR_SPACE_CONVERT gcn_addr_space_convert
 #undef  TARGET_ARG_PARTIAL_BYTES
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index 46af75f978f8..a74e966fdfde 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -181,9 +181,6 @@ case "${target}" in
 
   amdgcn*-*-*)
 	config_path="gcn accel"
-
-	#TODO PR101484
-	XCFLAGS="$XCFLAGS -Wno-error=array-bounds"
 	;;
 
   *)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.