[Openmp-dev] variable 'new_value' is used uninitialized whenever 'if' condition is false
Jack Howarth
howarth.mailing.lists at gmail.com
Wed Jun 3 09:15:05 PDT 2015
Jonathan,
All of my builds on x86_64-apple-darwin14 are using the system
clang compilers from Xcode 6.3.2...
% clang -v
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
I'll try a rebuild with LLVM clang 3.6.0 and see if there is any
differences in the warnings produced.
Jack
On Wed, Jun 3, 2015 at 11:49 AM, Peyton, Jonathan L
<jonathan.l.peyton at intel.com> wrote:
> What compiler version is producing all these warnings? Is it clang 3.7?
>
> -- Johnny
>
> -----Original Message-----
> From: Jack Howarth [mailto:howarth.mailing.lists at gmail.com]
> Sent: Tuesday, June 2, 2015 7:03 PM
> To: Peyton, Jonathan L; openmp-dev at dcs-maillist2.engr.illinois.edu
> Subject: variable 'new_value' is used uninitialized whenever 'if' condition is false
>
> Jonathan,
> Are the warnings of the form...
>
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2035:1:
> warning: variable 'new_value' is used uninitialized whenever 'if'
> condition is false
> [-Wsometimes-uninitialized]
> MIN_MAX_COMPXCHG_CPT( fixed1, max_cpt, char, 8, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed1_max_cpt ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2028:9:
> note: expanded from macro 'MIN_MAX_COMPXCHG_CPT'
> GOMP_MIN_MAX_CRITSECT_CPT(OP,GOMP_FLAG) \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1984:9:
> note: expanded from macro 'GOMP_MIN_MAX_CRITSECT_CPT'
> MIN_MAX_CRITSECT_CPT( OP, 0 ); \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1968:10:
> note: expanded from macro 'MIN_MAX_CRITSECT_CPT'
> if ( *lhs OP rhs ) { /* still need actions? */ \
> ^~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2035:1:
> note: uninitialized use occurs here
> MIN_MAX_COMPXCHG_CPT( fixed1, max_cpt, char, 8, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed1_max_cpt ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2028:9:
> note: expanded from macro 'MIN_MAX_COMPXCHG_CPT'
> GOMP_MIN_MAX_CRITSECT_CPT(OP,GOMP_FLAG) \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1984:9:
> note: expanded from macro 'GOMP_MIN_MAX_CRITSECT_CPT'
> MIN_MAX_CRITSECT_CPT( OP, 0 ); \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1977:12:
> note: expanded from macro 'MIN_MAX_CRITSECT_CPT'
> return new_value; \
> ^~~~~~~~~
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2035:1:
> note: remove the 'if' if its condition is always true
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2028:9:
> note: expanded from macro 'MIN_MAX_COMPXCHG_CPT'
> GOMP_MIN_MAX_CRITSECT_CPT(OP,GOMP_FLAG) \
> ^
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1984:9:
> note: expanded from macro 'GOMP_MIN_MAX_CRITSECT_CPT'
> MIN_MAX_CRITSECT_CPT( OP, 0 ); \
> ^
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:1968:5:
> note: expanded from macro 'MIN_MAX_CRITSECT_CPT'
> if ( *lhs OP rhs ) { /* still need actions? */ \
> ^
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2035:41:
> note: variable 'new_value' is declared here
> MIN_MAX_COMPXCHG_CPT( fixed1, max_cpt, char, 8, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed1_max_cpt
> ^
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2026:5:
> note: expanded from macro 'MIN_MAX_COMPXCHG_CPT'
> TYPE new_value, old_value; \
> ^
>
> significant? These seem to be generated from the macro definition...
>
> #define MIN_MAX_COMPXCHG_CPT(TYPE_ID,OP_ID,TYPE,BITS,OP,GOMP_FLAG) \
> ATOMIC_BEGIN_CPT(TYPE_ID,OP_ID,TYPE,TYPE) \
> TYPE new_value, old_value; \
> if ( *lhs OP rhs ) { \
> GOMP_MIN_MAX_CRITSECT_CPT(OP,GOMP_FLAG) \
> MIN_MAX_CMPXCHG_CPT(TYPE,BITS,OP) \
> } \
> return *lhs; \
> }
>
> Jack
More information about the Openmp-dev
mailing list