[flang-commits] [flang] 18983df - [Flang] Don't crash when BOZ literals are on the rhs of an assignment
Peter Steinfeld via flang-commits
flang-commits at lists.llvm.org
Thu Feb 23 06:58:15 PST 2023
Author: Peter Steinfeld
Date: 2023-02-23T06:46:03-08:00
New Revision: 18983df02fdfb218a6e46620912ef1d0ebb428e9
URL: https://github.com/llvm/llvm-project/commit/18983df02fdfb218a6e46620912ef1d0ebb428e9
DIFF: https://github.com/llvm/llvm-project/commit/18983df02fdfb218a6e46620912ef1d0ebb428e9.diff
LOG: [Flang] Don't crash when BOZ literals are on the rhs of an assignment
For BOZ literals, the rhsType will be empty. Check for that before
trying to access its value.
Differential Revision: https://reviews.llvm.org/D144576
Added:
Modified:
flang/lib/Lower/Bridge.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 65993f50311b9..beac3b16d77bc 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2861,8 +2861,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
// runtime.
if (lhsType->IsPolymorphic() ||
lhsType->IsUnlimitedPolymorphic() ||
- rhsType->IsPolymorphic() ||
- rhsType->IsUnlimitedPolymorphic()) {
+ (rhsType && (rhsType->IsPolymorphic() ||
+ rhsType->IsUnlimitedPolymorphic()))) {
mlir::Value lhs;
if (Fortran::lower::isWholeAllocatable(assign.lhs))
lhs = genExprMutableBox(loc, assign.lhs).getAddr();
More information about the flang-commits
mailing list