forked from OSchip/llvm-project
[flang] Prevent segfault in DynamicType::IsTkCompatibleWith
Make sure `derived_` is not null before dereferencing it. This might only happen when there is a previous error. I saw it compiling a test program where a USEd module was not found. Original-commit: flang-compiler/f18@2db516556b Reviewed-on: https://github.com/flang-compiler/f18/pull/550
This commit is contained in:
parent
8d8a867b83
commit
0386490751
|
@ -171,7 +171,8 @@ bool DynamicType::IsTkCompatibleWith(const DynamicType &that) const {
|
||||||
return true;
|
return true;
|
||||||
} else if (that.IsUnlimitedPolymorphic()) {
|
} else if (that.IsUnlimitedPolymorphic()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!IsKindCompatible(*derived_, *that.derived_)) {
|
} else if (!derived_ || !that.derived_ ||
|
||||||
|
!IsKindCompatible(*derived_, *that.derived_)) {
|
||||||
return false; // kind params don't match
|
return false; // kind params don't match
|
||||||
} else if (!IsPolymorphic()) {
|
} else if (!IsPolymorphic()) {
|
||||||
return derived_->typeSymbol() == that.derived_->typeSymbol();
|
return derived_->typeSymbol() == that.derived_->typeSymbol();
|
||||||
|
|
Loading…
Reference in New Issue