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

commit e4500d17bf469a2b85fecd02a67dc564a5bd2cb1
Author: Rainer Orth <[email protected]>
Date:   Tue Jun 2 17:05:31 2026 +0200

    libgomp: Don't use alloca directly
    
    This patch
    
    commit a36f0edbec6f2ef36792eda245fa7e512d032872
    Author: Arsen Arsenović <[email protected]>
    Date:   Thu Apr 23 10:47:38 2026 +0000
    
        libgomp: let plugins handle allocating the target variable table
    
    broke Solaris bootstrap:
    
    In file included from libgomp/oacc-parallel.c:30:
    libgomp/oacc-parallel.c: In function ‘GOACC_parallel_keyed’:
    libgomp/oacc-parallel.c:297:45: error: implicit declaration of function 
‘alloca’ [-Wimplicit-function-declaration]
      297 |        : gomp_offload_session_new (acc_dev, alloca));
          |                                             ^~~~~~
    libgomp/libgomp.h:1510:21: note: in definition of macro 
‘gomp_offload_session_new’
     1510 |     void *session = alloc (devicep->session.size);      \
          |                     ^~~~~
    libgomp/oacc-parallel.c:297:45: error: incompatible implicit declaration of 
built-in function ‘alloca’ [-Werror=builtin-declaration-mismatch]
    libgomp/libgomp.h:1510:21: note: in definition of macro 
‘gomp_offload_session_new’
     1510 |     void *session = alloc (devicep->session.size);      \
          |                     ^~~~~
    
    and similarly in target.c.
    
    alloca is declared in <alloca.h> on Solaris.  Therefore the code should
    use gomp_alloca instead, which is just for such cases.
    
    Bootstrapped without regressions on i386-pc-solaris2.11,
    sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.
    
    2026-06-01  Rainer Orth  <[email protected]>
    
            libgomp:
            * oacc-parallel.c (GOACC_parallel_keyed): Use gomp_alloca instead
            of alloca.
            * target.c (GOMP_target): Likewise.
            (GOMP_target_ext): Likewise.
    
    (cherry picked from commit 800581c66c8cea57d4ad61178b29e2408ab12153)

Diff:
---
 libgomp/oacc-parallel.c | 2 +-
 libgomp/target.c        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index 08f969d7d7ac..3770af510f29 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -294,7 +294,7 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
   /* Prepare an offload session.  */
   struct gomp_offload_session *session
     = (aq ? gomp_offload_session_new (acc_dev, gomp_malloc)
-       : gomp_offload_session_new (acc_dev, alloca));
+       : gomp_offload_session_new (acc_dev, gomp_alloca));
 
   struct target_mem_desc *tgt
     = goacc_map_vars (acc_dev, aq, mapnum, hostaddrs, NULL, sizes, kinds, true,
diff --git a/libgomp/target.c b/libgomp/target.c
index af9b37c0c8c8..cd25a5b8a4ed 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -3251,7 +3251,7 @@ GOMP_target (int device, void (*fn) (void *), const void 
*unused,
     return gomp_target_fallback (fn, hostaddrs, devicep, NULL);
 
   struct gomp_offload_session *session
-    = gomp_offload_session_new (devicep, alloca);
+    = gomp_offload_session_new (devicep, gomp_alloca);
 
   htab_t refcount_set = htab_create (mapnum);
   struct target_mem_desc *tgt_vars
@@ -3577,7 +3577,7 @@ GOMP_target_ext (int device, void (*fn) (void *), size_t 
mapnum,
   htab_t refcount_set = NULL;
 
   struct gomp_offload_session *session
-    = gomp_offload_session_new (devicep, alloca);
+    = gomp_offload_session_new (devicep, gomp_alloca);
 
   if (devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
     {

Reply via email to