[PATCH] Document arithmetic overflow semantics
Joseph S. Myers
jsm28@cam.ac.uk
Thu Feb 13 16:42:00 GMT 2003
On Thu, 13 Feb 2003, Roger Sayle wrote:
> I can submit a patch to constant fold x << y to zero, for suitably
> large y, if anyone disagrees. It will of course break the above
I'd prefer a patch that codes it as an abort (or, better yet, records that
this code path cannot be executed - so that given "if (x) y << 200;", we
conclude that x == 0). We already have precedent for generating an abort
for code that is known to be undefined if ever executed but is allowed in
a strictly conforming program if never executed - va_arg(ap, char). I
think a patch to generate an abort for this code would be entirely
acceptable, as would one to treat the code as unreachable (but the latter
might be more difficult, since we don't have a tree node saying "this is
unreachable").
--
Joseph S. Myers
jsm28@cam.ac.uk
More information about the Gcc
mailing list