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

Jack Howarth howarth.mailing.lists at gmail.com
Tue Jun 2 17:21:45 PDT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: initialize.patch
Type: application/octet-stream
Size: 727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150602/f9e7590f/attachment.obj>


More information about the Openmp-dev mailing list