------- Comment #5 from joseph at codesourcery dot com  2009-01-21 23:27 -------
Subject: Re:  Optimisation with inline function causes invalid
 behaviour

On Wed, 21 Jan 2009, rguenth at gcc dot gnu dot org wrote:

> You overflow x and y in main() which invokes undefined behavior.

Actually, I don't think this is undefined behavior; I think it's the same 
as bug 35634.  There is no arithmetic on int8_t in C; the values are 
promoted to int (defined), arithmetic is done on int (which doesn't 
overflow for the promoted values) and if the values are then stored back 
in int8_t they are converted back (where the implementation-defined 
conversions are documented, and it's implementation-defined not 
undefined).  But we know in bug 35634 that GCC is wrongly treating 
increment/decrement of types such as int8_t as having undefined behavior, 
by not representing the intermediate promotions and truncations.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38929

Reply via email to