From a94af876a1be069c56d4bfdd0b18d5ad76a10fcb Mon Sep 17 00:00:00 2001 From: Chenguang Wang Date: Wed, 3 Apr 2024 09:43:44 -0700 Subject: [PATCH] Initialize DefaultTimingManager::out. `DefaultTimingManager::clear()` uses `out` to initialize `TimerImpl`, but the `out` is `nullptr` by default. This means if `DefaultTimingManager::setOutput()` is never called, `DefaultTimingManager` destructor may generate SIGSEGV. --- mlir/lib/Support/Timing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Support/Timing.cpp b/mlir/lib/Support/Timing.cpp index 1d6796e9d8dc5..ac16eb7d224c9 100644 --- a/mlir/lib/Support/Timing.cpp +++ b/mlir/lib/Support/Timing.cpp @@ -499,7 +499,8 @@ class DefaultTimingManagerImpl { } // namespace mlir DefaultTimingManager::DefaultTimingManager() - : impl(std::make_unique()) { + : impl(std::make_unique()), + out(std::make_unique(llvm::errs())) { clear(); // initializes the root timer }