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: GCC optimizes integer overflow: bug or feature?


Gabriel Dos Reis wrote:
Andrew Haley <aph@redhat.com> writes:

| Robert Dewar writes:
| > Andrew Haley wrote:
| > | > > We've already defined `-fwrapv' for people who need nonstandard
| > > arithmetic.
| > | > Nonstandard implies that the result does not conform with the standard,
| | I don't think it does; it merely implies that any program which
| requires "-fwrapv" for correct execution is not a strictly conforming
| program.


How many useful C programs do you know that are strictly conforming?
Certainly, GCC isn't stritcly conforming.

The other danger in using nonstandard in this peculiar way is that it is too easy to use or at least think in terms of the argument.

This feature is nonstandard
We want gcc to be standard
Therefore we don't want this feature

which is faulty reasoning in this particular case. The ONLY reason
for doing the optimization is to improve performance, it does not
somehow make gcc more standard to take implement undefined in an
unpredictable manner :-)


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