aboutsummaryrefslogtreecommitdiff
path: root/libgomp/libgomp.h
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-07-16 19:12:02 +0200
committerThomas Schwinge <thomas@codesourcery.com>2021-07-19 10:26:12 +0200
commit9f2bc5077debef2b046b6c10d38591ac324ad8b5 (patch)
tree97ca95683939a273fa435ce8bee2587743399ad1 /libgomp/libgomp.h
parent3d7686a30fcf0e44133f28673b722b5f57e430c5 (diff)
downloadgcc-9f2bc5077debef2b046b6c10d38591ac324ad8b5.zip
gcc-9f2bc5077debef2b046b6c10d38591ac324ad8b5.tar.gz
gcc-9f2bc5077debef2b046b6c10d38591ac324ad8b5.tar.bz2
[gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' [PR101484]
... seen as of commit a110855667782dac7b674d3e328b253b3b3c919b "Correct handling of variable offset minus constant in -Warray-bounds [PR100137]". Awaiting a different solution, of course. libgomp/ PR target/101484 * config/gcn/team.c: Apply '-Werror=array-bounds' work-around. * libgomp.h [__AMDGCN__]: Likewise.
Diffstat (limited to 'libgomp/libgomp.h')
-rw-r--r--libgomp/libgomp.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 8d25dc8..4159cbe 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -128,7 +128,10 @@ team_malloc (size_t size)
: "=v"(result) : "v"(TEAM_ARENA_FREE), "v"(size), "e"(1L) : "memory");
/* Handle OOM. */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds" /*TODO PR101484 */
if (result + size > *(void * __lds *)TEAM_ARENA_END)
+# pragma GCC diagnostic pop
{
/* While this is experimental, let's make sure we know when OOM
happens. */
@@ -159,8 +162,11 @@ team_free (void *ptr)
However, if we fell back to using heap then we should free it.
It would be better if this function could be a no-op, but at least
LDS loads are cheap. */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds" /*TODO PR101484 */
if (ptr < *(void * __lds *)TEAM_ARENA_START
|| ptr >= *(void * __lds *)TEAM_ARENA_END)
+# pragma GCC diagnostic pop
free (ptr);
}
#else
@@ -789,13 +795,19 @@ static inline struct gomp_thread *gcn_thrs (void)
{
/* The value is at the bottom of LDS. */
struct gomp_thread * __lds *thrs = (struct gomp_thread * __lds *)4;
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds" /*TODO PR101484 */
return *thrs;
+# pragma GCC diagnostic pop
}
static inline void set_gcn_thrs (struct gomp_thread *val)
{
/* The value is at the bottom of LDS. */
struct gomp_thread * __lds *thrs = (struct gomp_thread * __lds *)4;
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds" /*TODO PR101484 */
*thrs = val;
+# pragma GCC diagnostic pop
}
static inline struct gomp_thread *gomp_thread (void)
{