[llvm-bugs] [Bug 52296] New: alpha.core.BoolAssignment does not work (at least for C and C++)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 25 11:03:50 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52296

            Bug ID: 52296
           Summary: alpha.core.BoolAssignment does not work (at least for
                    C and C++)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: nok.raven at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

I am not sure whether alpha.core.BoolAssignment is supposed to work with C and
C++ code
(https://clang-analyzer.llvm.org/alpha_checks.html#alpha.core.BoolAssignment
suggests it is only for ObjC?) though source code
(https://github.com/llvm/llvm-project/blob/e356027016c6365b3d8924f54c33e2c63d931492/clang/lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp#L43-L53)
might indicate it should, but the next code (derived from the documentation
example) does not produce a warning:

#include <stdbool.h>
typedef int BOOL;
void test() {
  BOOL foo = -1;
  _Bool bar = -1;
  bool qaz = -1;
}

https://godbolt.org/z/MMTzcYz65

See also
https://stackoverflow.com/questions/69592513/scan-build-for-clang-13-not-showing-errors

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211025/093a8755/attachment.html>


More information about the llvm-bugs mailing list