https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115160
--- Comment #2 from Ra'anan Lori <raanan.lori at getnexar dot com> --- it's sad to see this response, since the major issue here is that a user that wants to use the undefined behaviour sanitizer in such a case will not only get no warning but also still have the UB and will get a changed value because of it the "bogus" test case, is simplified example from a much bigger code base that illustrates the exact issue. i would expect that a detection for cpp code (instead of raw c) would also catch the UB, but it seems it won't. so i would at least expect the UB sanitizer to warn against not really working when used with cpp code.