From ede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Tue, 16 May 2023 15:08:11 -0700 Subject: [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. --- flang/lib/Semantics/check-call.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'flang') 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 &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); -- cgit v1.2.1