[Openmp-dev] variable 'new_value' is used uninitialized whenever 'if' condition is false

Churbanov, Andrey Andrey.Churbanov at intel.com
Wed Jun 3 13:01:54 PDT 2015


This could be a real problem, we need to investigate further.

Thanks,
Andrey

> -----Original Message-----
> From: openmp-dev-bounces at cs.uiuc.edu [mailto:openmp-dev-
> bounces at cs.uiuc.edu] On Behalf Of Jack Howarth
> Sent: Wednesday, June 03, 2015 7:53 PM
> To: Peyton, Jonathan L
> Cc: openmp-dev at dcs-maillist2.engr.illinois.edu
> Subject: Re: [Openmp-dev] variable 'new_value' is used uninitialized whenever
> 'if' condition is false
> 
> Jonathan,
>       I also see these same errors when building current openmp using the LLVM
> clang 3.6.0 compilers instead of the system compilers on x86_64-apple-
> darwin14.
>                              Jack
> 
> /sw/src/fink.build/llvm37-3.7.0-100/llvm-
> 3.7.0.src/projects/openmp/runtime/src/kmp_atomic.c:2037:1:
> warning: variable 'new_value' is used uninitialized whenever 'if'
>       condition is false [-Wsometimes-uninitialized]
> MIN_MAX_COMPXCHG_CPT( fixed2,  max_cpt, short,      16, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed2_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:2037:1:
> note: uninitialized use occurs here
> MIN_MAX_COMPXCHG_CPT( fixed2,  max_cpt, short,      16, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed2_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:2037: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:2037:41:
> note: variable 'new_value' is declared here
> MIN_MAX_COMPXCHG_CPT( fixed2,  max_cpt, short,      16, <,
> KMP_ARCH_X86 ) // __kmpc_atomic_fixed2_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;                                             \
>     ^
> 
> 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
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at dcs-maillist2.engr.illinois.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/openmp-dev

--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park, 
17 Krylatskaya Str., Bldg 4, Moscow 121614, 
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the Openmp-dev mailing list