This is the mail archive of the 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 ..."

Paul Schlie wrote:

So this proposal would be tantamount to implementing a different
language at -O1 and -O2, and having -O2 change the formal
semantic interpretation of the program. That seems a very
bad idea to me.

Yes, it would be laudable for GCC to adopt the principle that whatever language semantics are chosen in absents of optimization should be preserved through -O2 by default; although may be explicitly overridden as may be desired by the user.

Note Paul that I think you may be confusing what I say, when I talk about language semantics, I am talking about the formal semantics of the language, which may well have non-deterministic, undefined, or implementation defined elements. I am NOT talking about preserving observed behavior. You have rather consistently confused the two.

Further as this may be target specific, for target machine implementations which inherently support trapping on overflow (or null pointer dereference); GCC may correspondingly then enable through -O2 optimizations presuming the same; but by principle not otherwise for targets for which GCC does not factually support these semantics.

No, that's completely wrong, overflow is undefined in the semantics, so preserving undefined semantics has nothing whatever with preserving observed behavior for these programs with undefined semantics. Here is exactly where you are confusing behavior with semantics.

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