Left shift of negative value

Martin Sebor msebor@gmail.com
Tue Dec 1 17:11:00 GMT 2015

On 12/01/2015 09:07 AM, Andrew Haley wrote:
> Do we support left shift of a negative value?  Technically it's
> undefined and ubsan warns about it.  However, a ton of software would
> surely break if we didn't do the obvious right thing.  I can't find
> anything in the GCC manual.

I believe gcc does the expected thing but see bug 65179:

There have been discussions on gcc-patches about some of
the issues the warning has exposed (real or otherwise),
for example:



More information about the Gcc-help mailing list