[Openmp-dev] variable 'new_value' is used uninitialized whenever 'if' condition is false
Peyton, Jonathan L
jonathan.l.peyton at intel.com
Wed Jun 3 08:49:20 PDT 2015
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