hanchenye-llvm-project/clang
Kristof Umann b8ac93c73b [analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic location construction
Summary:
https://bugs.llvm.org/show_bug.cgi?id=43102

In today's edition of "Is this any better now that it isn't crashing?", I'd like to show you a very interesting test case with loop widening.

Looking at the included test case, it's immediately obvious that this is not only a false positive, but also a very bad bug report in general. We can see how the analyzer mistakenly invalidated `b`, instead of its pointee, resulting in it reporting a null pointer dereference error. Not only that, the point at which this change of value is noted at is at the loop, rather then at the method call.

It turns out that `FindLastStoreVisitor` works correctly, rather the supplied explodedgraph is faulty, because `BlockEdge` really is the `ProgramPoint` where this happens.
{F9855739}
So it's fair to say that this needs improving on multiple fronts. In any case, at least the crash is gone.

Full ExplodedGraph: {F9855743}

Reviewers: NoQ, xazax.hun, baloghadamsoftware, Charusso, dcoughlin, rnkovacs, TWeaver

Subscribers: JesperAntonsson, uabelho, Ka-Ka, bjope, whisperity, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66716

llvm-svn: 372269
2019-09-18 22:24:26 +00:00
..
INPUTS
bindings [clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase 2019-06-26 07:39:03 +00:00
cmake [CMake][Fuchsia] Enable experimental pass manager by default 2019-08-29 23:12:06 +00:00
docs Recommit -r372180 2019-09-18 15:09:49 +00:00
examples Fixup build of clang-interpreter example after change in r370122. 2019-08-28 02:13:24 +00:00
include [Sema] Suppress -Wformat diagnostics for bool types when printed using %hhd 2019-09-18 19:05:14 +00:00
lib [analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic location construction 2019-09-18 22:24:26 +00:00
runtime
test [analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic location construction 2019-09-18 22:24:26 +00:00
tools [Timers] Fix printing some `-ftime-report` sections twice. Fixes PR40328. 2019-09-18 00:05:45 +00:00
unittests [clang-format][PR41899] PointerAlignment: Left leads to useless space in lambda intializer expression 2019-09-18 19:11:40 +00:00
utils Add SpellingNotCalculated to Attribute Enums to suppress UBSan warnings 2019-09-17 14:11:51 +00:00
www [c++20] P1331R2: Allow transient use of uninitialized objects in 2019-09-18 17:37:44 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [CMake] Don't set Python_ADDITIONAL_VERSIONS 2019-07-18 15:17:42 +00:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/