[flang] Avoid null pointer dereference
authorpeter klausler <pklausler@nvidia.com>
Wed, 3 Jul 2019 22:16:36 +0000 (15:16 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 3 Jul 2019 23:00:25 +0000 (16:00 -0700)
Original-commit: flang-compiler/f18@3c108c0edcdbf67e75039ddcefba74598905e87c
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false

flang/lib/evaluate/type.cc

index 047e3b7..f98cdcc 100644 (file)
@@ -174,7 +174,7 @@ bool DynamicType::IsTkCompatibleWith(const DynamicType &that) const {
   } else if (!derived_ || !that.derived_ ||
       !IsKindCompatible(*derived_, *that.derived_)) {
     return false;  // kind params don't match
-  } else if (!IsPolymorphic()) {
+  } else if (!IsPolymorphic() && that.derived_ != nullptr) {
     return derived_->typeSymbol() == that.derived_->typeSymbol();
   } else {
     return IsAncestorTypeOf(derived_, that.derived_);