> Not so appalling really, given that relying on wrapping is as has
> been pointed out in this thread, the most natural and convenient way
> of testing for overflow. It is really *quite* difficult to test for
> overflow while avoiding overflow, and this is something that is
> probably not in the lexicon of many C programmers.

I guess that's true even in GCC.  I looked at the OVERFLOW_SUM_SIGN macro in
fold-const.c.  But on the positive side, the test is isolated in one place
and so is easy to fix.

Moreover, as was said earlier in this thread, although it's hard to formally
define the subset, it's hard to see how any of the optimizations proposed
that take advantage of undefined overflow would, in pratice, actually break
this idiom.

Reply via email to