This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add new built-in: __builtin_unreachable()


David Daney <ddaney@caviumnetworks.com> writes:

> +@deftypefn {Built-in Function} void __builtin_unreachable (void)
> +This function is used to indicate to the compiler that control flow
> +will never reach the point of the @code{__builtin_unreachable}.  If
> +control flow does reach @code{__builtin_unreachable}, program behavior
> +is undefined.  The only valid use of this builtin is immediately
> +following an @code{asm} statement that either never exits or transfers
> +control elsewhere never returning.

I have wanted __builtin_unreachable for a while, but never got around to
doing anything.  But I only want it if it works in general, not just
after an asm statement.  I think it should mean "if control flow reaches
this point, the program is undefined."  Ideally there should be a
command line option to control it, so that it is possible to compile
__builtin_unreachable as expanding to abort, or something like that,
when debugging.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]