On 17/11/2015 18:39, Markus Armbruster wrote: > The kernel switched from -fwrapv to -fno-strict-overflow in '09, because > -fwrapv was buggy in gcc 4.1 (already old then, completely irrelevant > now), and because it "seems to be much less disturbing to gcc too: the > difference in the generated code by -fno-strict-overflow are smaller > (compared to using neither flag) than when using -fwrapv", which may or > may not be still the case with compilers that matter today. > > Could you briefly explain why you picked -fwrapv and not > -fno-strict-overflow?
Because -fno-strict-overflow doesn't silence ubsan, only -fwrapv does (it doesn't silence it for negative left shifts, but I've asked on gcc-patches whether they'd like to have that fixed as well). In the meanwhile I got some good news from the GCC folks: >> I think we should remove the ", but this is subject to change" in >> implement-c.texi (while replacing it with noting that ubsan will still >> diagnose such cases, and they will also be diagnosed where constant >> expressions are required). Paolo