llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.82k stars 11.45k forks source link

Analyzer misses potential pointer invalidations #26147

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 25773
Version trunk
OS Linux
Attachments Code demonstrating the bug
Reporter LLVM Bugzilla Contributor

Extended Description

The example hinges on the fact that pointers to objects that a managed by a container or smart pointer can be invalidated by operations on the container or smart pointer.

$ scan-build g++ -std=c++1z potential_ptr_invalidation.cpp scan-build: Using 'local/tmp/clang/bin/clang' for static analysis scan-build: Removing directory '/tmp/scan-build-2015-12-08-153923-8231-1' because it contains no reports. scan-build: No bugs found.

Example taken from the talk "CppCon 2015: Herb Sutter "Writing Good C++14... By Default" at 49:54 (a Microsoft static analysis tool was demonstrated that is supposedly able to catch this bug)

llvmbot commented 8 years ago

assigned to @tkremenek