[flang-commits] [flang] [flang] Fix segfault in CSHIFT/EOSHIFT with dynamically optional DIM (PR #184431)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Wed Mar 4 09:06:37 PST 2026


================
@@ -509,9 +534,33 @@ mlir::Value HlfirEOShiftLowering::lowerImpl(
   mlir::Value shift = operands[1];
   mlir::Value boundary = operands[2];
   mlir::Value dim = operands[3];
-  // If DIM is present, then dereference it if it is a ref.
-  if (dim)
+  if (loweredActuals[3] && loweredActuals[3]->handleDynamicOptional()) {
+    // DIM is a dynamically optional dummy argument.
+    // Use getIsPresent() directly (per eugeneepshteyn's review) rather than a
----------------
vzakhari wrote:

Please also remove the user ids and the special symbol in this comment.

https://github.com/llvm/llvm-project/pull/184431


More information about the flang-commits mailing list