On 02/09/2016 07:24 AM, Richard Henderson wrote:
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'm glad they agree: https://llvm.org/bugs/show_bug.cgi?id=16154

What clang version are you using, Peter?


r~

Reply via email to