[flang-commits] [flang] 4210eb1 - Revert "[flang] Fix a warning"

David Spickett via flang-commits flang-commits at lists.llvm.org
Fri Jan 12 07:06:06 PST 2024


Author: David Spickett
Date: 2024-01-12T15:05:46Z
New Revision: 4210eb1d704c3ba602328efc8924147b2e98ed18

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

LOG: Revert "[flang] Fix a warning"

This reverts commit 18734f606635f4f4270f911b68060890ce3dd94a.

This caused a test suite failure on our bots:
https://lab.llvm.org/buildbot/#/builders/184/builds/9407

```
$ ~/stage1.install/bin/flang-new flush_1.f90
/usr/bin/ld: /home/david.spickett/stage1.install/lib/libFortranRuntime.a(extensions.cpp.o): in function `getlog_':
extensions.cpp:(.text.getlog_+0x1c): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: extensions.cpp:(.text.getlog_+0x7c): undefined reference to `operator delete(void*)'
/usr/bin/ld: extensions.cpp:(.text.getlog_+0xc4): undefined reference to `operator delete(void*)'
/usr/bin/ld: extensions.cpp:(.text.getlog_+0xe8): undefined reference to `operator delete(void*)'
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
```

Added: 
    

Modified: 
    flang/runtime/extensions.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/extensions.cpp b/flang/runtime/extensions.cpp
index 352da8f11d9d56..f72acf83a4409f 100644
--- a/flang/runtime/extensions.cpp
+++ b/flang/runtime/extensions.cpp
@@ -108,13 +108,12 @@ void FORTRAN_PROCEDURE_NAME(getlog)(std::byte *arg, std::int64_t length) {
   if (nameMaxLen == -1)
     nameMaxLen = _POSIX_LOGIN_NAME_MAX + 1;
 #endif
-  std::vector<char> str(nameMaxLen);
+  char str[nameMaxLen];
 
-  int error{getlogin_r(str.data(), nameMaxLen)};
+  int error{getlogin_r(str, nameMaxLen)};
   if (error == 0) {
     // no error: find first \0 in string then pad from there
-    CopyAndPad(reinterpret_cast<char *>(arg), str.data(), length,
-        std::strlen(str.data()));
+    CopyAndPad(reinterpret_cast<char *>(arg), str, length, std::strlen(str));
   } else {
     // error occur: get username from environment variable
     GetUsernameEnvVar("LOGNAME", arg, length);


        


More information about the flang-commits mailing list