> 
> I finally got a chance to take a look at this issue and it turned out to
> be as you suspected in the PR comments.  The assumed Posix layout of the
> pthread_mutex_t does not match that used by Darwin.  I wonder, in passing
> how the 64b implementations happen to work (and also if there are any
> other pthread layout cases I should audit).
> 
> Tested on i686-darwin9, 17; x86_64-darwin17,23,24,
> OK for trunk and 15?

No, that can't be right:

> +++ b/gcc/ada/libgnat/s-oslock__darwin.ads
[...]
> +
> +--  This is a Darwin version of this package
> +
> +with Interfaces.C;
> +with System.OS_Constants;
> +
> +package System.OS_Locks is
> +   pragma Preelaborate;
> +
> +   type pthread_mutex_t is limited private;
> +
> +   subtype RTS_Lock is pthread_mutex_t;
> +   --  Should be used inside the runtime system. The difference between Lock
> +   --  and the RTS_Lock is that the latter serves only as a semaphore so that
> +   --  we do not check for ceiling violations.
> +
> +private
> +
> +   subtype char_array is Interfaces.C.char_array;
> +
> +   type pthread_mutex_t is record
> +      __sig : Interfaces.C.long;

The above is not a valid identifier for Ada, it should be sig, or uu_sig

You should have gotten a compilation error. If you didn't, it means your change 
isn't taken into
account.

> +      Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE);
> +   end record;
> +   pragma Convention (C, pthread_mutex_t);
> +
> +end System.OS_Locks;

Reply via email to