https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62630

--- Comment #17 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Fri, 20 Feb 2015, mircea.namolaru at inria dot fr wrote:

> Yes, but it seems to me that the cast (not in the original code) should 
> not be generated at all if it could not be guaranteed that the casted-to 
> type is larger enough to accommodate it. Otherwise you introduce a cast 
> from a longer signed type to a shorter signed one whose behaviour is 
> undefined by the C standard and was not in the original code.

Such casts have defined semantics in GNU C (and presumably in GIMPLE).  
(In ISO C, "either the result is implementation-defined or an 
implementation-defined signal is raised" - not undefined behavior.)

Reply via email to