On 05/06/2015 15:33, Peter Maydell wrote: > This is applied, but can you fix the clang sanitizer warnings, > please? > > hw/ppc/spapr_drc.c:59:24: runtime error: left shift of negative value -1 > hw/ppc/spapr_drc.c:587:19: runtime error: left shift of negative value -1 > > Problem looks to be in: > #define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT)) > > which is doing left shifts on a negative signed number.
Speaking in general, I find that this makes code worse. If you're using ~0 you probably want the value to extend with infinite ones. Using ~0u instead of ~0ull may cause problems down the line, and ~0ul is even worse because it is not 64-bit safe. Paolo