[PATCH] D30295: [analyzer] clarify undef shift result when shift count is negative or exceeds the bit width

Daniel Marjamäki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 04:53:23 PST 2017


danielmarjamaki created this revision.

The error messages are confusing when shift result is undefined because the shift count is negative or exceeds the bit width. I have seen that users often draw the conclusion that Clang thinks some operand is uninitialized and determine that Clang shows a false positive.

I also know that some users use negative shift count by intention and don't think that would cause problems.

This patch clarify the error message and refactors the code a little.


Repository:
  rL LLVM

https://reviews.llvm.org/D30295

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
  lib/StaticAnalyzer/Checkers/ConversionChecker.cpp
  lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
  lib/StaticAnalyzer/Core/CheckerHelpers.cpp
  test/Analysis/bitwise-ops.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30295.89498.patch
Type: text/x-patch
Size: 7872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170223/5a544ed1/attachment.bin>


More information about the cfe-commits mailing list