[Bug target/19293] avr-gcc crashes when using shifts with negative shift count

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 6 18:03:00 GMT 2005


------- Additional Comments From joseph at codesourcery dot com  2005-01-06 18:03 -------
Subject: Re:  avr-gcc crashes when using shifts with negative
 shift count

On Thu, 6 Jan 2005, bjoern dot m dot haase at web dot de wrote:

> It seems that the standard says that shift operations with negative shift count 
> are supposed to yield an "unspecified" result. 

Undefined, not unspecified.

> Is there some more specific convention for gcc on how to behave in these cases? 

For some other cases of runtime undefined behavior we generate an abort 
(with a warning that we are doing so).  This is what we do for va_arg with 
types changed by the default argument promotions, and for calls to 
functions cast to incompatible types.  We could do it for negative or 
too-wide shifts as well if we wish, either generally or for the specific 
targets for which they are problems.



-- 


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



More information about the Gcc-bugs mailing list