[PATCH] D19975: [scan-build] fix warning emitted on LLVM Bitcode code base
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 08:13:10 PDT 2016
tejohnson added a comment.
> Fix a logic error warning of the type "called C++ object pointer is null" emitted by Clang Static Analyzer on the following file
What does this error mean? It seems like a case where we would get a maybe uninitialized warning, if -Wmaybe-uninitialized was enabled (but its my understanding that there is a conscious decision not to enable this warning for llvm). In this case, we have assertion checks (noted below) that ensure we never use these without initializing them.
If we need to fix this case to silence an analyzer, I'd rather initialize those abbrevs to 0 and add an assert down near the uses that they are non-zero (as noted below the default added in this patch doesn't make sense for this bitcode record type).
================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:2512
@@ -2513,1 +2511,3 @@
+ unsigned FnEntry7BitAbbrev = VST_ENTRY_7_ABBREV;
+ unsigned FnEntry6BitAbbrev = VST_ENTRY_6_ABBREV;
if (IsModuleLevel && hasVSTOffsetPlaceholder()) {
----------------
These are not correct abbrev ids for this code.
================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:2576
@@ -2575,3 +2575,3 @@
assert(FunctionToBitcodeIndex);
assert(hasVSTOffsetPlaceholder());
----------------
The above 2 asserts will ensure that we never reach here without initializing FnEntry*BitAbbrev.
http://reviews.llvm.org/D19975
More information about the llvm-commits
mailing list