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

Peyton, Jonathan L jonathan.l.peyton at intel.com
Wed Jun 3 12:36:07 PDT 2015


LGTM.
Committed revision 238954.

-- Johnny

-----Original Message-----
From: Jack Howarth [mailto:howarth.mailing.lists at gmail.com] 
Sent: Tuesday, June 2, 2015 7:22 PM
To: Peyton, Jonathan L; openmp-dev at dcs-maillist2.engr.illinois.edu
Subject: variable 'retval' is used uninitialized whenever 'if' condition is false

Jonathan,
       The following change is needed to suppress the 'variable 'retval' is used uninitialized whenever 'if' condition is false'
warnings in runtime/src/kmp_csupport.c.

/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2511:16:
warning: variable 'retval' is used uninitialized whenever 'if'
condition is false
      [-Wsometimes-uninitialized]
    } else if( TEST_REDUCTION_METHOD( packed_reduction_method, tree_reduce_block ) ) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp.h:455:13:
note: expanded from macro 'TEST_REDUCTION_METHOD'
            ( ( UNPACK_REDUCTION_METHOD( packed_reduction_method ) ) == ( which_reduction_block ) )
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2555:12:
note: uninitialized use occurs here
    return retval;
           ^~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2511:12:
note: remove the 'if' if its condition is always true
    } else if( TEST_REDUCTION_METHOD( packed_reduction_method, tree_reduce_block ) ) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2434:15:
note: initialize the variable 'retval' to silence this warning
    int retval;
              ^
               = 0
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2671:16:
warning: variable 'retval' is used uninitialized whenever 'if'
condition is false
      [-Wsometimes-uninitialized]
    } else if( TEST_REDUCTION_METHOD( packed_reduction_method, tree_reduce_block ) ) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp.h:455:13:
note: expanded from macro 'TEST_REDUCTION_METHOD'
            ( ( UNPACK_REDUCTION_METHOD( packed_reduction_method ) ) == ( which_reduction_block ) )
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2699:12:
note: uninitialized use occurs here
    return retval;
           ^~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2671:12:
note: remove the 'if' if its condition is always true
    } else if( TEST_REDUCTION_METHOD( packed_reduction_method, tree_reduce_block ) ) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/src/fink.build/llvm37-3.7.0-100/llvm-3.7.0.src/projects/openmp/runtime/src/kmp_csupport.c:2632:15:
note: initialize the variable 'retval' to silence this warning
    int retval;
              ^
               = 0

               Jack




More information about the Openmp-dev mailing list