[PATCH] D119705: [flang] Fix `LoweringBridge::validModule`

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 04:22:12 PST 2022


awarzynski created this revision.
awarzynski added reviewers: rovka, clementval, schweitz, Leporacanthicus.
Herald added a project: Flang.
awarzynski requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119705

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


Index: flang/include/flang/Lower/Bridge.h
===================================================================
--- flang/include/flang/Lower/Bridge.h
+++ flang/include/flang/Lower/Bridge.h
@@ -84,7 +84,7 @@
   /// Create a folding context. Careful: this is very expensive.
   Fortran::evaluate::FoldingContext createFoldingContext() const;
 
-  bool validModule() { return getModule(); }
+  bool validModule() { return (nullptr != module); }
 
   //===--------------------------------------------------------------------===//
   // Perform the creation of an mlir::ModuleOp


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119705.408376.patch
Type: text/x-patch
Size: 573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220214/203d5da7/attachment.bin>


More information about the llvm-commits mailing list