forked from OSchip/llvm-project
[flang] Fix arg specs for CMPLX intrinsic
Original-commit: flang-compiler/f18@3586b8a646 Reviewed-on: https://github.com/flang-compiler/f18/pull/477 Tree-same-pre-rewrite: false
This commit is contained in:
parent
fb1fcbb9cd
commit
5774f0ab30
|
@ -289,8 +289,8 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
|
|||
{"char", {{"i", AnyInt}, DefaultingKIND}, KINDChar},
|
||||
{"cmplx", {{"x", AnyComplex}, DefaultingKIND}, KINDComplex},
|
||||
{"cmplx",
|
||||
{{"x", SameIntOrReal, Rank::elementalOrBOZ},
|
||||
{"y", SameIntOrReal, Rank::elementalOrBOZ, Optionality::optional},
|
||||
{{"x", AnyIntOrReal, Rank::elementalOrBOZ},
|
||||
{"y", AnyIntOrReal, Rank::elementalOrBOZ, Optionality::optional},
|
||||
DefaultingKIND},
|
||||
KINDComplex},
|
||||
{"command_argument_count", {}, DefaultInt, Rank::scalar},
|
||||
|
@ -411,7 +411,7 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
|
|||
KINDInt, Rank::vector},
|
||||
{"leadz", {{"i", AnyInt}}, DefaultInt},
|
||||
{"len", {{"string", AnyChar, Rank::anyOrAssumedRank}, SubscriptDefaultKIND},
|
||||
KINDInt},
|
||||
KINDInt, Rank::scalar},
|
||||
{"len_trim", {{"string", AnyChar}, SubscriptDefaultKIND}, KINDInt},
|
||||
{"lge", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
||||
{"lgt", {{"string_a", SameChar}, {"string_b", SameChar}}, DefaultLogical},
|
||||
|
@ -734,7 +734,8 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
|
|||
{{"index", {{"string", DefaultChar}, {"substring", DefaultChar}},
|
||||
DefaultInt}},
|
||||
{{"isign", {{"a", DefaultInt}, {"b", DefaultInt}}, DefaultInt}, "sign"},
|
||||
{{"len", {{"string", DefaultChar, Rank::anyOrAssumedRank}}, DefaultInt}},
|
||||
{{"len", {{"string", DefaultChar, Rank::anyOrAssumedRank}}, DefaultInt,
|
||||
Rank::scalar}},
|
||||
{{"log", {{"x", DefaultReal}}, DefaultReal}},
|
||||
{{"log10", {{"x", DefaultReal}}, DefaultReal}},
|
||||
{{"max0",
|
||||
|
@ -966,7 +967,7 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
|
|||
}
|
||||
if (!argOk) {
|
||||
messages.Say(
|
||||
"actual argument for '%s=' has bad type or kind '%s'"_err_en_US,
|
||||
"Actual argument for '%s=' has bad type or kind '%s'"_err_en_US,
|
||||
d.keyword, type->AsFortran());
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@ -981,7 +982,7 @@ std::optional<SpecificCall> IntrinsicInterface::Match(
|
|||
const IntrinsicDummyArgument &d{dummy[std::min(j, dummyArgPatterns - 1)]};
|
||||
if (const ActualArgument * arg{actualForDummy[j]}) {
|
||||
if (IsAssumedRank(*arg) && d.rank != Rank::anyOrAssumedRank) {
|
||||
messages.Say("assumed-rank array cannot be forwarded to "
|
||||
messages.Say("Assumed-rank array cannot be forwarded to "
|
||||
"'%s=' argument"_err_en_US,
|
||||
d.keyword);
|
||||
return std::nullopt;
|
||||
|
@ -1403,6 +1404,7 @@ std::optional<SpecificCall> IntrinsicProcTable::Implementation::Probe(
|
|||
std::string name{call.name.ToString()};
|
||||
auto specificRange{specificFuncs_.equal_range(name)};
|
||||
for (auto iter{specificRange.first}; iter != specificRange.second; ++iter) {
|
||||
CHECK(localBuffer.empty());
|
||||
if (auto specificCall{
|
||||
iter->second->Match(call, defaults_, arguments, localContext)}) {
|
||||
if (const char *genericName{iter->second->generic}) {
|
||||
|
@ -1422,6 +1424,7 @@ std::optional<SpecificCall> IntrinsicProcTable::Implementation::Probe(
|
|||
parser::Messages genericBuffer;
|
||||
auto genericRange{genericFuncs_.equal_range(name)};
|
||||
for (auto iter{genericRange.first}; iter != genericRange.second; ++iter) {
|
||||
CHECK(localBuffer.empty());
|
||||
if (auto specificCall{
|
||||
iter->second->Match(call, defaults_, arguments, localContext)}) {
|
||||
// Apply any semantic checks peculiar to the intrinsic
|
||||
|
|
Loading…
Reference in New Issue