[flang] Fix intrinsic table probing issue with DOUBLE COMPLEX

The probing table was only expecting REAL for kind code
`KindCode::doublePrecision` that is also used for
`DoublePrecisionComplex`.
Add related tests.

Original-commit: flang-compiler/f18@342ed7e769
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
This commit is contained in:
Jean Perier 2019-08-23 05:37:37 -07:00
parent 252e22ea97
commit 98af2162d0
2 changed files with 13 additions and 4 deletions

View File

@ -1206,10 +1206,9 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
DynamicType{*category, defaults.GetDefaultKind(TypeCategory::Real)};
break;
case KindCode::doublePrecision:
CHECK(result.categorySet == RealType);
CHECK(*category == TypeCategory::Real);
resultType =
DynamicType{TypeCategory::Real, defaults.doublePrecisionKind()};
CHECK(result.categorySet == CategorySet{*category});
CHECK(FloatingType.test(*category));
resultType = DynamicType{*category, defaults.doublePrecisionKind()};
break;
case KindCode::defaultCharKind:
CHECK(result.categorySet == CharType);

View File

@ -226,6 +226,16 @@ void TestIntrinsics() {
amin1Call.DoCall(Real4::GetType());
amin1WrongCall.DoCall();
TestCall{table, "conjg"}
.Push(Const(Scalar<Complex4>{}))
.DoCall(Complex4::GetType());
TestCall{table, "conjg"}
.Push(Const(Scalar<Complex8>{}))
.DoCall(Complex8::GetType());
TestCall{table, "dconjg"}.Push(Const(Scalar<Complex4>{})).DoCall();
TestCall{table, "dconjg"}
.Push(Const(Scalar<Complex8>{}))
.DoCall(Complex8::GetType());
// TODO: test other intrinsics
}
}