Some builtin functions, like __atomic_fetch_add, have a generic return type which libgccjit consider to be void.
That makes it impossible to use this value.
Thanks to fix this issue.
I think the builtin __atomic_fetch_add should not be used directly from the JIT front-end, rather __atomic_fetch_add_N should be used instead.
An attempt to use, let's say, __atomic_fetch_add_4, will result in a error like:
libgccjit.so: error: unimplemented primitive type for builtin (type: BT_I4)
Created attachment 50832 [details]
Patch to fix the issues with using atomic builtins
I implemented the missing types and fixed the type checking.
*** Bug 96067 has been marked as a duplicate of this bug. ***
The master branch has been updated by Antoni Boucher <email@example.com>:
Author: Antoni Boucher <firstname.lastname@example.org>
Date: Sat Dec 11 16:42:54 2021 -0500
libgccjit: Add support for types used by atomic builtins [PR96066] [PR96067]
2021-12-11 Antoni Boucher <email@example.com>
* jit-builtins.c: Implement missing types for builtins.
* jit-recording.c:: Allow sending a volatile const void * as
* jit-recording.h: New functions (is_volatile, is_const) and
allow comparing qualified types.
* jit.dg/all-non-failing-tests.h: Add test-builtin-types.c.
* jit.dg/test-fuzzer.c: Add fuzzing for type qualifiers.
Signed-off-by: Antoni Boucher <firstname.lastname@example.org>
Fixed in master.