[PATCH] D135375: [analyzer] Initialize regions returned by CXXNew to undefined
Kristóf Umann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 6 10:32:30 PDT 2022
Szelethus created this revision.
Szelethus added reviewers: NoQ, martong, steakhal, balazske, isuckatcs.
Szelethus added a project: clang.
Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: All.
Szelethus requested review of this revision.
Herald added a subscriber: cfe-commits.
Discourse mail: https://discourse.llvm.org/t/analyzer-why-do-we-suck-at-modeling-c-dynamic-memory/65667
`malloc()` returns a piece of uninitialized dynamic memory. We were (almost) always to model this behaviour. Its C++ counterpart, `operator new` is a lot more complex, because it allows for initialization, the most complicated of which the usage of constructors.
We gradually became better in modeling constructors, but for some reason, most likely for reasons lost in history, we never actually modeled the case when the memory returned by `operator new` was just simply uninitialized. This patch (attempts) to fix this tiny little error.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135375
Files:
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/test/Analysis/NewDelete-checker-test.cpp
clang/test/Analysis/cxx-member-initializer-const-field.cpp
clang/test/Analysis/new-ctor-conservative.cpp
clang/test/Analysis/new-ctor-recursive.cpp
clang/test/Analysis/new.cpp
clang/test/Analysis/placement-new.cpp
clang/test/Analysis/reinterpret-cast.cpp
clang/test/Analysis/uninit-const.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135375.465779.patch
Type: text/x-patch
Size: 7443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221006/4cdd98b3/attachment.bin>
More information about the cfe-commits
mailing list