------- Comment #5 from rguenth at gcc dot gnu dot org 2005-12-01 12:46 ------- I.e. 6.3.1.3/3 says that conversion from type T to signed type is implementation defined if the value doesn't fit. And we define it to reducing it modulo 2^N.
So, for !flag_wrapv (short)((int)0x8000 << 1) == 0 but 0x8000 << 1 is undefined. So this transformation is only ok for flag_wrapv. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25186