On Thu, Aug 13, 2015 at 01:11:53PM +0200, Richard Biener wrote:
> Rather ubsan should not complain about implementation defined behavior (or
> should separate those cases out with a different switch compared to undefined
> behavior).
I think ubsan doesn't complain about implementation-defined behavior. It seems
to me that in this thread it only (rightfully) complained about left-shifting of
negative value.
Using __GCC__ conditional in a case where we rely on what gcc does when
right-shifting a negative value, i.e. that it sign-extends, seems fine
(ubsan certainly doesn't error on that).
Marek