This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients congma, vstinner
Date 2021-03-24.14:06:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616594789.39.0.884555568806.issue43615@roundup.psfhosted.org>
In-reply-to
Content
> 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?
History
Date User Action Args
2021-03-24 14:06:29vstinnersetrecipients: + vstinner, congma
2021-03-24 14:06:29vstinnersetmessageid: <1616594789.39.0.884555568806.issue43615@roundup.psfhosted.org>
2021-03-24 14:06:29vstinnerlinkissue43615 messages
2021-03-24 14:06:29vstinnercreate