[PATCH] D74161: Fix MSAN failure on Function destruction
Antonio Maiorano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 6 13:38:09 PST 2020
amaiorano created this revision.
amaiorano added a reviewer: eugenis.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
When Function is destroyed, GlobalValue base class is destroyed, then
Value destructor would call use_empty, which ultimately attempts to
downcast 'this' to GlobalValue. This is UB, and is caught my MSAN as
accessing uninitialized memory.
Call materialized_use_empty, which doesn't call
assertModuleIsMaterializedImpl().
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74161
Files:
llvm/lib/IR/Value.cpp
Index: llvm/lib/IR/Value.cpp
===================================================================
--- llvm/lib/IR/Value.cpp
+++ llvm/lib/IR/Value.cpp
@@ -83,7 +83,7 @@
// reference and something is wrong. This code is here to print out where
// the value is still being referenced.
//
- if (!use_empty()) {
+ if (!materialized_use_empty()) {
dbgs() << "While deleting: " << *VTy << " %" << getName() << "\n";
for (auto *U : users())
dbgs() << "Use still stuck around after Def is destroyed:" << *U << "\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74161.242993.patch
Type: text/x-patch
Size: 535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200206/bbf6b966/attachment.bin>
More information about the llvm-commits
mailing list