This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]