[U-Boot] clang sandbox warning

Jeroen Hofstee jeroen at myspectrum.nl
Tue Jun 10 20:38:28 CEST 2014


Hello Simon,

While trying to find a u-boot make command which likely works with a
pre-build clang linux package I got the following warnings:

`make CC="clang -no-integrated-as" HOSTCC="clang -no-integrated-as"
HOST_TOOLS_ALL=y sandbox_config tools`


/home/jeroen/software/u-boot/arch/sandbox/include/asm/bitops.h:59:17:
warning: variable 'flags' is uninitialized when used here
[-Wuninitialized]
        local_irq_save(flags);
                       ^~~~~
/home/jeroen/software/u-boot/arch/sandbox/include/asm/bitops.h:56:21:
note: initialize the variable 'flags' to silence this warning
        unsigned long flags;
                           ^
                            = 0
/home/jeroen/software/u-boot/arch/sandbox/include/asm/bitops.h:81:17:
warning: variable 'flags' is uninitialized when used here
[-Wuninitialized]
        local_irq_save(flags);
                       ^~~~~
/home/jeroen/software/u-boot/arch/sandbox/include/asm/bitops.h:78:21:
note: initialize the variable 'flags' to silence this warning
        unsigned long flags;
                           ^
                            = 0

I guess gcc accepts this since flags is not actually used. Anyway merely
mentioned for completeness. You might be interested in:

/home/jeroen/software/u-boot/tools/../lib/rsa/rsa-sign.c:77:6: warning:
variable 'ret' is used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
        if (!rsa) {
            ^~~~
/home/jeroen/software/u-boot/tools/../lib/rsa/rsa-sign.c:94:9: note:
uninitialized use occurs here
        return ret;
               ^~~
/home/jeroen/software/u-boot/tools/../lib/rsa/rsa-sign.c:77:2: note:
remove the 'if' if its condition is always false
        if (!rsa) {
        ^~~~~~~~~~~
/home/jeroen/software/u-boot/tools/../lib/rsa/rsa-sign.c:48:9: note:
initialize the variable 'ret' to silence this warning
        int ret;
               ^
                = 0

which actually looks like a bug. And:


/home/jeroen/software/u-boot/tools/../lib/rsa/rsa-verify.c:59:27:
warning: comparison of unsigned expression >= 0 is always true
[-Wtautological-compare]
        for (i = key->len - 1; i >= 0; i--) {
                               ~ ^  ~


which looks a bit odd, especially since there is no way to break out of
the loop and reach the final return statement, which has a comment to
that it might be useful (equal).

Regards,
Jeroen






More information about the U-Boot mailing list