[flang-commits] [flang] dda3c14 - [flang] Fix `LoweringBridge::validModule`

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Wed Feb 16 02:57:47 PST 2022


Author: Andrzej Warzynski
Date: 2022-02-16T10:41:57Z
New Revision: dda3c14fd7db8fc2f9ef2baee09b44476ce0d56c

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

LOG: [flang] Fix `LoweringBridge::validModule`

This patch updates `validModule` not to use `getModule`.  `getModule`
will dereference `module`, but that will lead to a seg-fault if `module`
is a `nullptr`.

Differential Revision: https://reviews.llvm.org/D119705

Added: 
    

Modified: 
    flang/include/flang/Lower/Bridge.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Lower/Bridge.h b/flang/include/flang/Lower/Bridge.h
index 7232a85c5413c..2965cf012134f 100644
--- a/flang/include/flang/Lower/Bridge.h
+++ b/flang/include/flang/Lower/Bridge.h
@@ -84,7 +84,7 @@ class LoweringBridge {
   /// Create a folding context. Careful: this is very expensive.
   Fortran::evaluate::FoldingContext createFoldingContext() const;
 
-  bool validModule() { return getModule(); }
+  bool validModule() { return (module != nullptr); }
 
   //===--------------------------------------------------------------------===//
   // Perform the creation of an mlir::ModuleOp


        


More information about the flang-commits mailing list