bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC optimizes integer overflow: bug or feature?


From: Joseph S. Myers
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Thu, 21 Dec 2006 23:14:35 +0000 (UTC)

On Thu, 21 Dec 2006, Ian Lance Taylor wrote:

> > Another question for the GCC experts: would it fix the bug
> > if we replaced "j *= 2" with "j <<= 1" in this sample code?
> 
> Well, mainline VRP isn't clever enough to understand that case.  But
> it doesn't make the code any more defined.  A left shift of a signed
> value to a value which can not be represented in the signed type is
> also undefined (C99 6.5.7).

As noted, it's only undefined in C99 not C90 and we document that this 
undefinedness isn't used at present; and non-front-end code can't use 
flag_isoc99 since it isn't available in non-C-family front ends.

-- 
Joseph S. Myers
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]