Message389455
> The current implementation tests the ``__GNUC__`` and ``__GNUC_MINOR__`` macros as the logic (GCC version >= 4.5) for determining whether the compiler intrinsic ``__builtin_unreachable()`` is present (see commits eebaa9bf, 24ba3b0d). However, Clang defines these macros too and can cause confusion. Clang 11 pretends to be GCC 4.2.1 in its predefined macros. As a result, Clang won't use the intrinsic even if it's supported. This doesn't seem to match the intent behind the original implementation.
Hum. The current code is:
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define Py_UNREACHABLE() __builtin_unreachable()
#elif defined(__clang__) || defined(__INTEL_COMPILER)
# define Py_UNREACHABLE() __builtin_unreachable()
Even if clang pretends to be GCC 4.2 and the first test fails, the second test is true and so Py_UNREACHABLE() is always defined as __builtin_unreachable() on clang, no?
You can please better explain your problem? You can write a short C code demonstrating the bug? |
|
Date |
User |
Action |
Args |
2021-03-24 14:06:29 | vstinner | set | recipients:
+ vstinner, congma |
2021-03-24 14:06:29 | vstinner | set | messageid: <1616594789.39.0.884555568806.issue43615@roundup.psfhosted.org> |
2021-03-24 14:06:29 | vstinner | link | issue43615 messages |
2021-03-24 14:06:29 | vstinner | create | |
|