Hi Arnaud,

> On 4 Dec 2025, at 13:39, Arnaud Charlet <[email protected]> wrote:
> 
>> 
>> 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

I can change it to that (say uu_sig), of course.

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

I just repeated the build and test - there are no warnings and/or erorrs about 
__sig.  There are likewise no warnings or errors about it in either the Acats 
or the gnat testsuite logs.  The build completes normally as does the testsuite.

The new file is correctly linked as far as I can tell.

If the change is not being taken into account, then some other property is 
causing > 120 tests to run correctly where they were previously failing (and 
that is the only change in the Ada tree).

                === acats Summary ===
# of expected passes            2578
# of unexpected failures        0
Native configuration is i686-apple-darwin9


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

^^^ does this, perhaps, also allow C-style names?

>> +
>> +end System.OS_Locks;

I’m not sure how to proceed at the moment - I can easily make the typographical 
changes (to the header and the symbol name) - but not sure how to test that 
I’ve “fixed” something,

thanks
Iain


Reply via email to