https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77642

--- Comment #1 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
On s390 32 bit size_t is "unsigned long". __splitstack_find in libgcc is
defined as follows:

extern void*                                   
__splitstack_find (void *, void *, size_t *, void **, void **, void **)

However, libgo/go/runtime/runtime2.go uses uintptr for gcstacksize and this
gets passed as pointer in libgo/runtime/proc.c for the third operand:

static void
doentersyscall()
{
        // Disable preemption because during this function g is in _Gsyscall
status,
        // but can have inconsistent g->sched, do not let GC observe it.
        g->m->locks++;

        // Leave SP around for GC and traceback.
#ifdef USING_SPLIT_STACK
        g->gcstack = __splitstack_find(nil, nil, &g->gcstacksize,
                                       &g->gcnextsegment, &g->gcnextsp,
                                       &g->gcinitialsp);
#else


Since neither of the two types can be changed we probably have to convert back
and fort here (untested):

diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 6ac8857..134ab6a 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -2052,9 +2052,11 @@ doentersyscall()

        // Leave SP around for GC and traceback.
 #ifdef USING_SPLIT_STACK
-       g->gcstack = __splitstack_find(nil, nil, &g->gcstacksize,
+       size_t gcstacksize = (size_t)g->gcstacksize;
+       g->gcstack = __splitstack_find(nil, nil, &gcstacksize,
                                       &g->gcnextsegment, &g->gcnextsp,
                                       &g->gcinitialsp);
+       g->gcstacksize = (uintptr)gcstacksize;
 #else
        {
                void *v;

Reply via email to