From 3f5d53a525c62c507a482fd5f4c08451835b342d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 18 Jun 2021 11:48:33 +0200 Subject: [PATCH] [Attributor] Fix UB behavior on uninitalized bool variables. Found by ASAN. --- llvm/lib/Transforms/IPO/Attributor.cpp | 4 ++-- llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 CalledFunctions; /// Does this function have a call to a function that we don't know about. - bool HasUnknownCallee; + bool HasUnknownCallee = false; }; } // namespace