{"push_id":858453387,"size":1,"distinct_size":0,"ref":"refs/heads/<1447080991-24995-1-git-send-email-peter.maydell@linaro.org>","head":"eccf666db54576ef80a582e46597992031367f6e","before":"48b07c8dfd8850119a631e5c93c4cead8bb594bf","commits":[{"sha":"eccf666db54576ef80a582e46597992031367f6e","author":{"email":"313afa09ce093b19ae1dd74f57c1ebd94508584c@linaro.org","name":"Peter Maydell"},"message":"hw/timer/hpet.c: Avoid signed integer overflow which results in bugs on OSX\n\nSigned integer overflow in C is undefined behaviour, and the compiler\nis at liberty to assume it can never happen and optimize accordingly.\nIn particular, the subtractions in hpet_time_after() and hpet_time_after64()\nwere causing OSX clang to optimize the code such that it was prone to\nhangs and complaints about the main loop stalling (presumably because\nwe were spending all our time trying to service very high frequency\nHPET timer callbacks). The clang sanitizer confirms the UB:\n\nhw/timer/hpet.c:119:26: runtime error: signed integer overflow: -2146967296 - 2147003978 cannot be represented in type 'int'\n\nFix this by doing the subtraction as an unsigned operation and then\nconverting to signed for the comparison.\n\nReported-by: Aaron Elkins <threcius@yahoo.com>\nSigned-off-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <1447080991-24995-1-git-send-email-peter.maydell@linaro.org>","distinct":false,"url":"https://api.github.com/repos/famz/qemu-patchew/commits/eccf666db54576ef80a582e46597992031367f6e"}]}