https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109112
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Last reconfirmed| |2023-07-13
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Note that the __builtin_unreachable variant is optimized as expected:
struct S { bool x; };
void do_something();
void fn(S s) {
if (s.x) __builtin_unreachable ();
if (s.x) do_something();
}
It's unfortunate that [[assume (x)]] is currently so much less useful than if
(!x) __builtin_unreachable(), which expresses almost the same thing.