On 02/08/2016 10:25 PM, Peter Maydell wrote:
Hi. This doesn't compile with clang, I'm afraid:

/home/petmay01/linaro/qemu-for-merges/tcg/tcg.c:2048:30: error:
comparison of constant 16 with expression of type 'TCGReg' is always
true [-Werror,-Wtautological-constant-out-of-range-compare]
             for(reg = 0; reg < TCG_TARGET_NB_REGS; reg++) {
                          ~~~ ^ ~~~~~~~~~~~~~~~~~~

Good grief. This is C, not C++. In C it isn't legal to reduce the width of the underlying type of the enum to the minimum width that contains the enumerators -- the underlying type must still be int or unsigned int. Thus reg must be able to hold the value 16 (or 1000 for that matter).

IMO this is a clang bug.

I guess I'll rearrange this code so that it doesn't use the enum in the loop.


r~

Reply via email to