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?


"Joseph S. Myers" <joseph@codesourcery.com> writes:

> Conversion of out-of-range integers to signed types is 
> implementation-defined not undefined,

Thanks for the correction; I keep forgetting that.  However,
a conforming implementation is allowed to raise a signal for
those conversions, which could break the code in question,
i.e., it could cause the test to report the wrong result.
So the distinction between undefined and
implementation-defined behavior doesn't much matter here.
(Presumably the code could work around the problem by
trapping the signal, but that is another can of porting
worms.)

I daresay many conversions of out-of-range values to signed
integers are in a similar boat.


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