[flang] fix crash in ASSOCIATED() intrinsic with two arguments

Original-commit: flang-compiler/f18@1a393ff43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-07-15 10:12:46 -07:00
parent fc638c021c
commit 29004ece95
1 changed files with 5 additions and 4 deletions

View File

@ -647,7 +647,7 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
// NUM_IMAGES, STOPPED_IMAGES, TEAM_NUMBER, THIS_IMAGE,
// COSHAPE
// TODO: Object characteristic inquiry functions
// ASSOCIATED, EXTENDS_TYPE_OF, IS_CONTIGUOUS,
// EXTENDS_TYPE_OF, IS_CONTIGUOUS,
// SAME_TYPE, STORAGE_SIZE
// TODO: Type inquiry intrinsic functions - these return constants
// BIT_SIZE, DIGITS, EPSILON, HUGE, KIND, MAXEXPONENT, MINEXPONENT,
@ -1077,9 +1077,10 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
}
break;
case Rank::known:
CHECK(knownArg == nullptr);
knownArg = arg;
argOk = true;
if (knownArg == nullptr) {
knownArg = arg;
}
argOk = rank == knownArg->Rank();
break;
case Rank::anyOrAssumedRank: argOk = true; break;
case Rank::conformable: