[flang-commits] [flang] d1de4fe - [flang] Avoid null pointer dereference

peter klausler via flang-commits flang-commits at lists.llvm.org
Thu Apr 9 08:15:19 PDT 2020


Author: peter klausler
Date: 2019-07-03T16:00:25-07:00
New Revision: d1de4fe462736e990299ebd9295312113fa86354

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

LOG: [flang] Avoid null pointer dereference

Original-commit: flang-compiler/f18 at 3c108c0edcdbf67e75039ddcefba74598905e87c
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false

Added: 
    

Modified: 
    flang/lib/evaluate/type.cc

Removed: 
    


################################################################################
diff  --git a/flang/lib/evaluate/type.cc b/flang/lib/evaluate/type.cc
index 047e3b72f178..f98cdcc65c81 100644
--- a/flang/lib/evaluate/type.cc
+++ b/flang/lib/evaluate/type.cc
@@ -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_);


        


More information about the flang-commits mailing list