Thread (1 message) 1 message, 1 author, 2018-09-17

Wsometimes-uninitialized warning

From: Will Deacon <hidden>
Date: 2018-09-17 09:35:09

On Sat, Sep 15, 2018 at 08:48:36AM -0700, Sodagudi Prasad wrote:
Hi All,

I have observed compile time issues with modules incremental compilation
using clang.
I referred to following clang documentation about this warning.
http://releases.llvm.org/3.2/tools/clang/docs/ReleaseNotes.html

But in kernel code, PERCPU_OP macro default case is not reachable to throw
this  -Wsometimes-uninitialized warning.
BUILD_BUG() is getting used for the default cases of the PERCPU_OP macro.
Have you observed -Wsometimes-uninitialized  warnings with clang when
compiling 4.14.6?


/arch/arm64/include/asm/percpu.h:102:1: note: variable 'ret' is declared
here
/arch/arm64/include/asm/percpu.h:52:2: note: expanded from macro 'PERCPU_OP'
        unsigned long loop, ret;                                        \
        ^
/arch/arm64/include/asm/percpu.h:103:1: error: variable 'ret' is used
uninitialized whenever switch default is taken
[-Werror,-Wsometimes-uninitialized]
PERCPU_OP(and, and)
^~~~~~~~~~~~~~~~~~~
/arch/arm64/include/asm/percpu.h:95:2: note: expanded from macro 'PERCPU_OP'
        default:                                                        \


Do you have any suggestions/comments?
FWIW, I had a go at rewriting that file last week:

https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=pcpu&id=126c36f538d494d0342ba8e95013936b85d7c5e2

With that, the switch statement disappears altogether.

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help