We are currently studying the usage of GCC builtins by GitHub projects and how well various tools support them. To that end, we are also developing a test suite for the most frequently used machine-independent GCC builtins (available at https://github.com/gcc-builtins/tests). We'd be glad to contribute the test suite (or parts of it) to cil, if you are interested.
Out of the currently 100 builtin tests, cilly passes 40. The builtins __builtin_bswap16 and __builtin_types_compatible_p seem to be supported, but produce incorrect results, as the test cases below demonstrate:
#include <assert.h>
#include <stdint.h>
int main() {
volatile uint16_t value = -1;
assert(__builtin_bswap16(value) == (uint16_t)-1);
return 0;
}
The second test case is derived from an example given by the GCC docs, which state:
An enum type is not considered to be compatible with another enum type even if both are compatible with the same integer type; this is what the C standard specifies. For example, enum {foo, bar} is not similar to enum {hot, dog}.
From the other failing test cases, 4 are due to warnings about long double values being treated as doubles, for example, in 68-__builtin_fabs.c:
treating long double constant 1.79769313486231570814527423731704357e+308L as double constant at test-cases/68-__builtin_fabs.c:11.
15 failures are caused by parsing errors of a header file, for example, included in 2-__builtin_islessequal.c:
Execution of 34 test cases failed by having received signal 11, for example, in 89-__atomic_compare_exchange.c. These failures seem to affect only atomic builtins.
The remaining 5 failures are due to unrecognized builtins, for example, in 57-__builtin_add_overflow.c:
cil-z7uEm65O.cil.c:(.text+0x3b): undefined reference to `__builtin_add_overflow'
We are currently studying the usage of GCC builtins by GitHub projects and how well various tools support them. To that end, we are also developing a test suite for the most frequently used machine-independent GCC builtins (available at https://github.com/gcc-builtins/tests). We'd be glad to contribute the test suite (or parts of it) to cil, if you are interested.
Out of the currently 100 builtin tests, cilly passes 40. The builtins
__builtin_bswap16
and__builtin_types_compatible_p
seem to be supported, but produce incorrect results, as the test cases below demonstrate:The second test case is derived from an example given by the GCC docs, which state:
From the other failing test cases, 4 are due to warnings about long double values being treated as doubles, for example, in
68-__builtin_fabs.c
:15 failures are caused by parsing errors of a header file, for example, included in
2-__builtin_islessequal.c
:Execution of 34 test cases failed by having
received signal 11
, for example, in89-__atomic_compare_exchange.c
. These failures seem to affect only atomic builtins.The remaining 5 failures are due to unrecognized builtins, for example, in
57-__builtin_add_overflow.c
: