Hi everyone,

we are currently studying the usage of GCC builtins [1] 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 TCC, if you are
interested.

We tested TCC 0.9.27 with this test suite and found that currently only 6
builtins are supported (__builtin_constant_p,
__builtin_extract_return_addr, __builtin_frame_address,
__builtin_return_address, __builtin_expect, and __builtin_choose_expr).

Furthermore, it appears that our test cases uncovered an erroneous
implementation of the __builtin_types_compatible_p builtin.

Here is the reduced test case:

#include <assert.h>

int main() {
  assert(!__builtin_types_compatible_p(enum {foo, bar}, enum {hot, dog}));
}


This is an example given by the GCC docs [1] which states: "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}."
GCC, Clang, and ICC implement this builtin correctly.

Best,
Manuel

[1] https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to