[PATCH] D19971: [scan-build] fix warnings emitted on LLVM TargetRecip code base

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 10:10:09 PDT 2016


spatel added inline comments.

================
Comment at: lib/Target/TargetRecip.cpp:74
@@ -73,3 +73,3 @@
   size_t RefPos;
-  uint8_t RefSteps;
+  uint8_t RefSteps = 0;
   StringRef RefStepString;
----------------
apelete wrote:
> spatel wrote:
> > dblaikie wrote:
> > > Does msan ever diagnose this as use-of-uninitialized? Or is this only used in the codepaths where it is initialized?
> > The intent was that RefSteps could only be used when RefStepString is valid and therefore not empty (see 'report_fatal_error' just above this). Could this be a false positive from scan-build?
> This one looks like a false positive indeed: scan-build seems unable to see that RefSteps is initialized in parseRefinementStep() below.
> Should I remove the initializations here and ignore the warnings ?
Yes, initializing to '0' could mask an actual problem. You could add asserts of the RefSteps value [0-9] just after the calls to parseRefinementStep() if that would make scan-build happier.


http://reviews.llvm.org/D19971





More information about the llvm-commits mailing list