summaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2023-05-16 15:08:11 -0700
committerPeter Klausler <pklausler@nvidia.com>2023-05-16 15:10:28 -0700
commitede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342 (patch)
treefd4e704e164a58d4e3bb1d3e6883ed1576d7d367 /flang
parent9beb817cc8db28e2755cd9e230256121d0edc246 (diff)
downloadllvm-ede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342.tar.gz
[flang] Fix llvm-test-suite/Fortran/gfortran/torture/execute/st_function_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.
Diffstat (limited to 'flang')
-rw-r--r--flang/lib/Semantics/check-call.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 4d6eb30b3e11..fc07b8d26ace 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -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);