[all-commits] [llvm/llvm-project] a504dd: [analyzer] Initialize regions returned by CXXNew t...

Kristóf Umann via All-commits all-commits at lists.llvm.org
Wed Oct 26 08:22:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a504ddc8bf9d5c406ea88b84b8495d7aae200d4c
      https://github.com/llvm/llvm-project/commit/a504ddc8bf9d5c406ea88b84b8495d7aae200d4c
  Author: Kristóf Umann <dkszelethus at gmail.com>
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    M clang/test/Analysis/NewDelete-checker-test.cpp
    M clang/test/Analysis/cxx-member-initializer-const-field.cpp
    M clang/test/Analysis/new-ctor-conservative.cpp
    M clang/test/Analysis/new-ctor-recursive.cpp
    M clang/test/Analysis/new.cpp
    M clang/test/Analysis/placement-new.cpp
    M clang/test/Analysis/reinterpret-cast.cpp
    M clang/test/Analysis/uninit-const.cpp

  Log Message:
  -----------
  [analyzer] Initialize regions returned by CXXNew to undefined

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 able to model this behaviour. Its C++ counterpart, operator new is a
lot more complex, because it allows for initialization, the most complicated of which is 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.

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




More information about the All-commits mailing list