[flang-commits] [flang] ede83e0 - [flang] Fix llvm-test-suite/Fortran/gfortran/torture/execute/st_function_1.f90

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue May 16 15:10:34 PDT 2023


Author: Peter Klausler
Date: 2023-05-16T15:10:28-07:00
New Revision: ede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342

URL: https://github.com/llvm/llvm-project/commit/ede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342
DIFF: https://github.com/llvm/llvm-project/commit/ede83e0eb8d1a4ca5279ed57c1d9f54f42fa8342.diff

LOG: [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.

Added: 
    

Modified: 
    flang/lib/Semantics/check-call.cpp

Removed: 
    


################################################################################
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);


        


More information about the flang-commits mailing list