state of clang(1)'s -Wshift-count-negative and -Wshift-overflow warnings

Dimitry Andric dim at FreeBSD.org
Thu Nov 3 15:11:06 UTC 2011


On 2011-11-03 11:45, Alexander Best wrote:
...
> /usr/git-freebsd-head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c:36:3: warning: signed shift result (0x200000000) requires 35 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
>                 OS_REG_RMW_FIELD(ah, AR_SCR, AR_SCR_SLE, AR_SCR_SLE_ALLOW);
>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/git-freebsd-head/sys/dev/ath/ath_hal/ah_internal.h:471:42: note: expanded from macro 'OS_REG_RMW_FIELD'
>                 (OS_REG_READ(_a, _r) &~ (_f)) | (((_v) << _f##_S) & (_f)))
>                                                        ^
> /usr/git-freebsd-head/sys/dev/ath/ah_osdep.h:127:49: note: expanded from macro 'OS_REG_WRITE'
>             (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val))
> 
> iirc, back then, it was labeled as a clang bug. however testing with clang tot,
> i still get those warnings. so i just wanted to ask again, whether the warnings
> are really bogus, or if these warnings actually indicate issues during
> shifting?

Those warnings are bogus, and due to this bug:

  http://llvm.org/bugs/show_bug.cgi?id=10030

Unfortunately, it is still not fixed for the 3.0 release branch, and I
don't expect it will be fixed for the actual release.


More information about the freebsd-toolchain mailing list