Skip to content

Commit

Permalink
[flang] Fix llvm-test-suite/Fortran/gfortran/torture/execute/st_funct…
Browse files Browse the repository at this point in the history
…ion_1.f90

I just broke the test llvm-test-suite/Fortran/gfortran/torture/execute/st_function_1.f90
with a recent patch.  The bug was obvious, as is the fix, which works, so
I'm just pushing it directly to make the build bots happy.
  • Loading branch information
klausler committed May 16, 2023
1 parent 9beb817 commit ede83e0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions flang/lib/Semantics/check-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,20 @@ static void CheckCharacterActual(evaluate::Expr<evaluate::SomeType> &actual,
messages.Say(
"Actual argument variable length '%jd' does not match the expected length '%jd'"_err_en_US,
*actualLength, *dummyLength);
} else if (*actualLength < *dummyLength &&
context.ShouldWarn(common::UsageWarning::ShortCharacterActual)) {
if (evaluate::IsVariable(actual)) {
messages.Say(
"Actual argument variable length '%jd' is less than expected length '%jd'"_warn_en_US,
*actualLength, *dummyLength);
} else {
messages.Say(
"Actual argument expression length '%jd' is less than expected length '%jd'"_warn_en_US,
*actualLength, *dummyLength);
} else if (*actualLength < *dummyLength) {
bool isVariable{evaluate::IsVariable(actual)};
if (context.ShouldWarn(common::UsageWarning::ShortCharacterActual)) {
if (isVariable) {
messages.Say(
"Actual argument variable length '%jd' is less than expected length '%jd'"_warn_en_US,
*actualLength, *dummyLength);
} else {
messages.Say(
"Actual argument expression length '%jd' is less than expected length '%jd'"_warn_en_US,
*actualLength, *dummyLength);
}
}
if (!isVariable) {
auto converted{ConvertToType(dummy.type.type(), std::move(actual))};
CHECK(converted);
actual = std::move(*converted);
Expand Down

0 comments on commit ede83e0

Please sign in to comment.