https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94754
--- Comment #1 from Alejandro Colomar <colomar.6.4.3 at gmail dot com> ---
__builin_unreachable() helped silencing that specific bug, as a temporary
workaround:
[[gnu::nonnull]]
static
int init_x(int cond, int **x, int *y)
{
if (!cond)
return -1;
*x = y;
return 0;
}
int foo(int cond)
{
int *x;
int y = 7;
if (cond < 2)
return -1;
/* cond >= 2 != 0, so it will initialize x and return 0 */
if (init_x(cond, &x, &y))
__builtin_unreachable();
return *x;
}