[llvm-branch-commits] [flang] aef3508 - [flang] Fixed uninitialized std::unique_ptr dereference.

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 23 07:35:12 PDT 2023


Author: Slava Zakharin
Date: 2023-03-23T15:33:09+01:00
New Revision: aef3508f89c4e9a075edb8fe3dda5e4901928538

URL: https://github.com/llvm/llvm-project/commit/aef3508f89c4e9a075edb8fe3dda5e4901928538
DIFF: https://github.com/llvm/llvm-project/commit/aef3508f89c4e9a075edb8fe3dda5e4901928538.diff

LOG: [flang] Fixed uninitialized std::unique_ptr dereference.

This fixes unittest failures reported in D142279:
  flang-Unit :: Frontend/./FlangFrontendTests/5/7
  flang-Unit :: Frontend/./FlangFrontendTests/6/7

(cherry picked from commit e054e0da9fd7055142188036ee713e8c0697324b)

Added: 
    

Modified: 
    flang/lib/Frontend/FrontendActions.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 64641b737f715..a54d7ff25eab1 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -779,7 +779,7 @@ void CodeGenAction::executeAction() {
   llvmModule->setDataLayout(tm->createDataLayout());
 
   // Run LLVM's middle-end (i.e. the optimizer).
-  runOptimizationPipeline(*os);
+  runOptimizationPipeline(ci.isOutputStreamNull() ? *os : ci.getOutputStream());
 
   if (action == BackendActionTy::Backend_EmitLL) {
     llvmModule->print(ci.isOutputStreamNull() ? *os : ci.getOutputStream(),


        


More information about the llvm-branch-commits mailing list