On 17 November 2015 at 09:45, Paolo Bonzini <[email protected]> wrote: > Again: let's stop this madness!!!!!!!!!!!!!!!!!!!!!! > > (Yes, so many exclamation marks). > > This is clearly computing -32768 * 2^N, not -(32768 * 2^N). The latter > is totally, utterly wrong, because 32768 is _not even expressible_ as a > 16-bit fixed point value, which OPL_MINOUT/OPL_MAXOUT obviously are. > > I'll shortly post a patch to disable this obnoxious warning.
This is undefined behaviour by the language spec. If clang is warning about it they obviously don't want to guarantee that they aren't ever going to rely on this UB for optimisation. I agree that it's a silly thing to have be UB, but that's what C is. I don't think we should be silencing this warning (or the runtime ubsan one) and I do think we should be fixing our UBs. I agree that the rephrasing isn't great; if you have a preferred non-UB way to write it I'm open to suggestions. thanks -- PMM
