STINNER Victor <vstin...@python.org> added the comment:

> 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?

----------
nosy: +vstinner

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43615>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to