pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libgpg-error core dumps on Solaris 10 sparc with gcc 4.9.2



On Mon, 11 May 2015, Ibraheem Saleh wrote:

> Building libgpg-error 1.19 on Solaris 10 sparc with gcc 4.9.2 succeeds
> without error but coredumps when trying to use it.
>
> bmake test fails all 5 of the tests with the same assertion message:
>
> gmake[2]: Entering directory
> `/usr/pkgsrc/security/libgpg-error/work/libgpg-error-1.19/tests'
> Assertion failed: !"sizeof lock obj", file posix-lock.c, line 119
> Abort (core dumped)
> FAIL: t-version
>
> Anyone know whats going on or how to fix this?

I'm thinking that the problem is that in _gpgrt_lock_t the second
element ends up being 64 bit aligned (a long of padding after vers)
giving a total sizeof=32 and no such alignment happens for
gpgrt_lock_t so sizeof=28.  I added a printf before the assert and it
reported those two exact different sizes, so that supports the theory.

typedef struct
{
  long _vers;
  union {
    volatile char _priv[24];
    long _x_align;
    long *_xp_align;
  } u;
} gpgrt_lock_t;

typedef struct
{
  long vers;
#if USE_POSIX_THREADS
  union {
    pthread_mutex_t mtx;
    long *dummy;
  } u;
#endif
} _gpgrt_lock_t;

I just tested on Solaris 10 Sparc and the following patch resolves the
problem.  I'm not sure if this patch is appropriate for all platforms
or only Sparc.  If someone else has the cycles to pass this fix
upstream that would be great.
(Also note I did NOT take out the patch from
patches/patch-src_estream.c when testing this fix... it seemed
unrelated to the assert failure.)


--- src/gen-posix-lock-obj.c.orig       Thu Nov  5 16:44:59 2015
+++ src/gen-posix-lock-obj.c    Thu Nov  5 16:49:19 2015
@@ -109,7 +109,7 @@
           "  union {\n"
           "    volatile char _priv[%d];\n"
           "%s"
-          "    long _x_align;\n"
+          "    long long _x_align;\n"
           "    long *_xp_align;\n"
           "  } u;\n"
           "} gpgrt_lock_t;\n"

Please include me directly in followups, I am not currently subscribed
to pkgsrc-users.

 - Tim


Home | Main Index | Thread Index | Old Index