[llvm] 3f5d53a - [Attributor] Fix UB behavior on uninitalized bool variables.
Haojian Wu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 18 02:49:57 PDT 2021
Author: Haojian Wu
Date: 2021-06-18T11:49:42+02:00
New Revision: 3f5d53a525c62c507a482fd5f4c08451835b342d
URL: https://github.com/llvm/llvm-project/commit/3f5d53a525c62c507a482fd5f4c08451835b342d
DIFF: https://github.com/llvm/llvm-project/commit/3f5d53a525c62c507a482fd5f4c08451835b342d.diff
LOG: [Attributor] Fix UB behavior on uninitalized bool variables.
Found by ASAN.
Added:
Modified:
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 957157d28bc7..8a918edf1cb7 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -2181,7 +2181,7 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
// Every argument might be simplified. We have to go through the Attributor
// interface though as outside AAs can register custom simplification
// callbacks.
- bool UsedAssumedInformation;
+ bool UsedAssumedInformation = false;
getAssumedSimplified(ArgPos, /* AA */ nullptr, UsedAssumedInformation);
// Every argument might be dead.
@@ -2257,7 +2257,7 @@ void Attributor::identifyDefaultAbstractAttributes(Function &F) {
// Call site argument might be simplified. We have to go through the
// Attributor interface though as outside AAs can register custom
// simplification callbacks.
- bool UsedAssumedInformation;
+ bool UsedAssumedInformation = false;
getAssumedSimplified(CBArgPos, /* AA */ nullptr, UsedAssumedInformation);
// Every call site argument might be marked "noundef".
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 2855676a109e..17d4870516c9 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -8245,7 +8245,7 @@ struct AACallEdgesFunction : public AACallEdges {
SetVector<Function *> CalledFunctions;
/// Does this function have a call to a function that we don't know about.
- bool HasUnknownCallee;
+ bool HasUnknownCallee = false;
};
} // namespace
More information about the llvm-commits
mailing list