Skip to content

Commit 4210eb1

Browse files
committed
Revert "[flang] Fix a warning"
This reverts commit 18734f6. 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) ```
1 parent 4f47372 commit 4210eb1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

flang/runtime/extensions.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ void FORTRAN_PROCEDURE_NAME(getlog)(std::byte *arg, std::int64_t length) {
108108
if (nameMaxLen == -1)
109109
nameMaxLen = _POSIX_LOGIN_NAME_MAX + 1;
110110
#endif
111-
std::vector<char> str(nameMaxLen);
111+
char str[nameMaxLen];
112112

113-
int error{getlogin_r(str.data(), nameMaxLen)};
113+
int error{getlogin_r(str, nameMaxLen)};
114114
if (error == 0) {
115115
// no error: find first \0 in string then pad from there
116-
CopyAndPad(reinterpret_cast<char *>(arg), str.data(), length,
117-
std::strlen(str.data()));
116+
CopyAndPad(reinterpret_cast<char *>(arg), str, length, std::strlen(str));
118117
} else {
119118
// error occur: get username from environment variable
120119
GetUsernameEnvVar("LOGNAME", arg, length);

0 commit comments

Comments
 (0)