This is the mail archive of the gcc@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: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


Richard Kenner wrote:
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.

It would make sense as was suggested earlier to define standard library routines or macros for overflow detection, and indeed this would be a useful and appropriate addition to the standard

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.


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