This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add new built-in: __builtin_unreachable()
- From: Ian Lance Taylor <iant at google dot com>
- To: David Daney <ddaney at caviumnetworks dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 03 Jun 2009 12:59:40 -0700
- Subject: Re: [PATCH] Add new built-in: __builtin_unreachable()
- References: <4A26C3EF.5040008@caviumnetworks.com>
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