On 11/17/15 11:28, Paolo Bonzini wrote: > > > On 17/11/2015 11:19, Peter Maydell wrote: >> I think we should only take this patch if you can get a cast-iron >> guarantee from both clang and gcc that they will never use this >> UB to drive optimizations. As you say gcc already say this more or >> less, but clang doesn't, and if they're warning about it that to >> me suggests that they will feel freer to rely on the UB in future. > > If and when this happens we will add "-fno-strict-overflow" for clang, > just like we are using "-fno-strict-aliasing" already.
How about adding "-fwrapv -fno-strict-overflow" right now? (Spelling out the latter of those explicitly for pointer arithmetic.) >> GCC is not our only supported compiler; UB is a real thing that >> compilers in general take advantage of; we should be trying to >> reduce our reliance on UB, not carving out extra areas where we >> feel free to use it. > > We are already feeling free to use it. > > Paolo >