[flang-commits] [flang] fb09447 - [flang] Fix a warning

Kazu Hirata via flang-commits flang-commits at lists.llvm.org
Thu Jan 11 12:14:48 PST 2024


Author: Kazu Hirata
Date: 2024-01-11T12:14:42-08:00
New Revision: fb09447132cb192a0ef5082d4a4bae30f893e501

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

LOG: [flang] Fix a warning

This patch fixes:

  flang/unittests/Runtime/CommandTest.cpp:702:14: error: variable
  length arrays are a C99 feature [-Werror,-Wvla-extension]

Added: 
    

Modified: 
    flang/unittests/Runtime/CommandTest.cpp

Removed: 
    


################################################################################
diff  --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index 668a3508653e4d..a0f14c519412a4 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -699,10 +699,10 @@ TEST_F(EnvironmentVariables, GetlogPadSpace) {
   if (charLen == -1)
     charLen = _POSIX_LOGIN_NAME_MAX + 2;
 #endif
-  char input[charLen];
+  std::vector<char> input(charLen);
 
   FORTRAN_PROCEDURE_NAME(getlog)
-  (reinterpret_cast<std::byte *>(input), charLen);
+  (reinterpret_cast<std::byte *>(input.data()), charLen);
 
   EXPECT_EQ(input[charLen - 1], ' ');
 }


        


More information about the flang-commits mailing list