Dear GNATCom,
With the 21.0 version of the GNAT pro compiler, I can compile GNATCom fine.
With the latest GNAT pro compiler, I get:
gnatcom-initialize.adb:63:13: warning: intrinsic binding type mismatch on result [enabled by default]
gnatcom-initialize.adb:63:13: warning: intrinsic binding type mismatch on parameter 2 [enabled by default]
gnatcom-initialize.adb:63:13: warning: profile of "sync_fetch_and_add" doesn't match the builtin it binds [enabled by default]
Looking at the GNATCom code:
function sync_fetch_and_add (Ref : access Integer;
Add : Integer) return Integer;
pragma Import (Intrinsic, sync_fetch_and_add,
"__sync_fetch_and_add_4");
shows a violation of the recommendations at
https://source.codeaurora.org/external/gigabyte/ag-gb-dsds-7227/plain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/lib/gcc/arm-eabi/4.4.3/plugin/include/sync-builtins.def?id=18065ea37751cc6fc3a07430b22f469df8d29339
/* Synchronization Primitives. The "_N" version is the one that the user is supposed to be using. It's overloaded, and is resolved to one of the "_1" through "_16" versions, plus some extra casts. */
Replacing __sync_fetch_and_add_4 by __sync_fetch_and_add_N indeed remove the warnings.
Greetings,
Pierre
P.S. No hard code N value works for __sync_fetch_and_add_1, __sync_fetch_and_add_2, __sync_fetch_and_add_4, __sync_fetch_and_add_8, and __sync_fetch_and_add_16
Unfortunately the suggested fix breaks compatibility with previous versions of GNAT (as recent as GNAT CE 21).
I get (trying with both 'N' and 'n'):
gnatcom-initialize.adb:85:1: undefined reference to
__sync_fetch_and_add_N
gnatcom-initialize.adb:85:1: undefined reference to
__sync_fetch_and_add_n
Perhaps it is better to try disabling the warning?