Message ID | 1454717370-17516-1-git-send-email-rth@twiddle.net |
---|---|
State | New |
Headers | show |
On 6 February 2016 at 00:09, Richard Henderson <rth@twiddle.net> wrote: > This contains two patches from December, and the portion that > has been reviewed of my tcg-indirect-register series for sparc. > The latter is mostly cleanup to tcg.c and so is nice to have > regardless of the rest of the patch set. > > > r~ > > > The following changes since commit ee8e8f92a730afc17ab8be6e86df6b9a23b8ebc6: > > Merge remote-tracking branch 'remotes/amit-migration/tags/migration-for-2.6-2' into staging (2016-02-05 14:20:46 +0000) > > are available in the git repository at: > > git://github.com/rth7680/qemu.git tags/pull-tcg-20160206 > > for you to fetch changes up to 78c9f7ee92717671d281882d33ef3f80ca711c95: > > tcg: Introduce temp_load (2016-02-06 10:44:31 +1100) > > ---------------------------------------------------------------- > Queued TCG patches. 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++) { ~~~ ^ ~~~~~~~~~~~~~~~~~~ /home/petmay01/linaro/qemu-for-merges/tcg/tcg.c:2204:22: 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++) { ~~~ ^ ~~~~~~~~~~~~~~~~~~ thanks -- PMM
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~
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~
On 8 February 2016 at 23:25, Richard Henderson <rth@twiddle.net> wrote: > On 02/09/2016 07:24 AM, Richard Henderson wrote: >> 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? This showed up with both: Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) Target: x86_64-pc-linux-gnu Thread model: posix and: Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin14.5.0 Thread model: posix thanks -- PMM