This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Document arithmetic overflow semantics
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, <gcc-patches at gcc dot gnu dot org>, <gcc at gcc dot gnu dot org>
- Date: Thu, 13 Feb 2003 16:36:02 +0000 (GMT)
- Subject: Re: [PATCH] Document arithmetic overflow semantics
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