https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99156
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|__builtin_expect affects |__builtin_expect is folded
|the interpretation of its |too soon allowing an
|first operand |non-integer-constant-expr
| |to become an
| |integer-const-expr
CC| |pinskia at gcc dot gnu.org
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is another example which shows the problem even further:
int maybe_vla(int n) {
goto label;
int arr[__builtin_expect(n-n, 0)];
label:
return sizeof(arr);
}
int main() { return maybe_vla(0); }
---- CUT ----
Basically __builtin_expect is folded too soon which allows the argument to be
considered a constant integer expression :).