[Openmp-dev] variable 'new_value' is used uninitialized whenever 'if' condition is false
Jack Howarth
howarth.mailing.lists at gmail.com
Tue Jun 2 17:03:01 PDT 2015
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