https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98549

--- Comment #14 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #13)
> For UB at runtime, we can warn, but shouldn't error because the code might
> never be invoked at runtime.

As far as I can see at least the C standard disagrees with this:
  NOTE Possible undefined behavior ranges from ignoring the situation
  completely with unpredictable results, to behaving during translation
  or program execution in a documented manner characteristic of the
  environment (with or without the issuance of a diagnostic message), to
  terminating a translation or execution (with the issuance of a
  diagnostic message).

So we are allowed to error.


It doesn't seem we will ever agree whether this is valid code.  This is
not a very useful discussion anyway: let's just make a small (valid code)
testcase and be done with it :-)

Reply via email to