https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125295
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Krister Walfridsson from comment #3) > Yes, this is a problem in the general case, but UBSAN does not suffer from > it because it generates `a + b` as > > _3 = .UBSAN_CHECK_ADD (a_1(D), b_2(D)); > > and waits until expand time to add the comparison and > __builtin___ubsan_handle_add_overflow call. > > So maybe it should handle shift in the same way? Yeah, I guess it should. At least the issue is somewhat relevant for UBSAN, not so much in practice otherwise.
