New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

Py_UNREACHABLE is used to indicate that a specific point in the program cannot 
be reached, even if the compiler might otherwise think it can. This is exact 
the case for __builtin_unreachable in GCC and Clang. I propose to extend 
Py_UNREACHABLE() to __builtin_unreachable() in the release mode. This will 
allow the compiler to generate more efficient code.

If there are circumstances in which Py_UNREACHABLE() is reachable, then it is 
improper use of Py_UNREACHABLE(). It should be replaced with raising an 
appropriate exception (like TypeError, ValueError, RuntimeError or SystemError) 
or, in extreme cases, with explicit Py_FatalError()

----------
components: Interpreter Core
messages: 352965
nosy: barry, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Optimize out Py_UNREACHABLE in the release mode
type: performance
versions: Python 3.9

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

Reply via email to