History log of /llvm-project/flang/unittests/Runtime/CommandTest.cpp (Results 1 – 25 of 34)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6
# af35e21c 03-Dec-2024 Kelvin Li <kkwli@users.noreply.github.com>

[flang] Update CommandTest for AIX (NFC) (#118403)

With the change in commit e335563, the behavior for `ECLGeneralErrorCommandErrorSync`
on AIX is the same as on Linux.


Revision tags: llvmorg-19.1.5
# e3355638 27-Nov-2024 David Truby <david.truby@arm.com>

[NFC][flang] Fix execute_command_line test for odd environments (#117714)

One of the execute_command_line tests currently runs `cat` on an invalid
file and checks its return value, but since we don

[NFC][flang] Fix execute_command_line test for odd environments (#117714)

One of the execute_command_line tests currently runs `cat` on an invalid
file and checks its return value, but since we don't control `cat` or
the user's path, the return value might not be reliably stable on a
per-platform basis. For example, if `git` is installed on Windows in
certain configurations it adds a directory to the path containing a
`cat` with a different set of error codes to the default Windows one.

This patch changes the test to use the `not` binary built by LLVM for
testing purposes, which should always return 1 on any platform
regardless of the user's environment.

show more ...


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4
# ba5e8fce 29-Aug-2024 Kelvin Li <kkwli@users.noreply.github.com>

[flang] Adjust execute_command_line intrinsic return values for AIX (NFC) (#106472)


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# dfd2711f 27-Jun-2024 Yi Wu <yi.wu2@arm.com>

Revert "Revert "[flang] Fix execute_command_line cmdstat is not set when error occurs" (#96365)" (#96774)

The fix broke llvm-test-suite, so it was reverted previously. With test
fixes added in http

Revert "Revert "[flang] Fix execute_command_line cmdstat is not set when error occurs" (#96365)" (#96774)

The fix broke llvm-test-suite, so it was reverted previously. With test
fixes added in https://github.com/llvm/llvm-test-suite/pull/137, it
should now pass the tests

This reverts commit 435635652fd226fa292abcff6a10d3df9dbd74e3.

show more ...


# 43563565 21-Jun-2024 Kiran Chandramohan <kiran.chandramohan@arm.com>

Revert "[flang] Fix execute_command_line cmdstat is not set when error occurs" (#96365)

Reverts llvm/llvm-project#93023

Reverting due to buildbot failure.
https://lab.llvm.org/buildbot/#/builder

Revert "[flang] Fix execute_command_line cmdstat is not set when error occurs" (#96365)

Reverts llvm/llvm-project#93023

Reverting due to buildbot failure.
https://lab.llvm.org/buildbot/#/builders/41/builds/227
test-suite ::
Fortran/gfortran/regression/gfortran-regression-execute-regression__execute_command_line_3_f90

show more ...


# 4232dd58 21-Jun-2024 Yi Wu <yi.wu2@arm.com>

[flang] Fix execute_command_line cmdstat is not set when error occurs (#93023)

Fixes: https://github.com/llvm/llvm-project/issues/92929
Also added cmdstat for common linux return code 1, 126, 127


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1
# 7c8ef765 29-Jan-2024 Yi Wu <43659785+yi-wu-arm@users.noreply.github.com>

[flang] add SYSTEM runtime and lowering intrinsics support (#74309)

Calls std::system() function and pass the command,
cmd on Windows or shell on Linux.
Command parameter is required, exitstatus i

[flang] add SYSTEM runtime and lowering intrinsics support (#74309)

Calls std::system() function and pass the command,
cmd on Windows or shell on Linux.
Command parameter is required, exitstatus is optional.
call system(command)
call system(command, exitstatus)

It calls `execute_command_line` runtime function with `wait` set to true.
---------

Co-authored-by: Yi Wu <yiwu02@wdev-yiwu02.arm.com>

show more ...


Revision tags: llvmorg-19-init
# 5a7f9a5a 19-Jan-2024 Yi Wu <43659785+yi-wu-arm@users.noreply.github.com>

[flang] use setsid to assign the child to prevent zombie as it will be clean up by init process (#77944)

When using `setsid()` in a child process created by `fork()`, a new
session is created, and

[flang] use setsid to assign the child to prevent zombie as it will be clean up by init process (#77944)

When using `setsid()` in a child process created by `fork()`, a new
session is created, and the child becomes a session leader. If the
parent process terminates before the child, the child becomes an orphan
and is adopted by the `init` process. The `init` process will eventually
clean up the child process once it exits.

However, killing the parent does not automatically kill the child; the
child will continue running until it exits.
Proper cleanup involves waiting for the child process to exit using
`wait()` or `waitpid()` in the parent process to avoid zombie processes,
but this approach is not valid for `EXECUTE_COMMAND_LINE` with async
mode.
Fix: https://github.com/llvm/llvm-project/issues/77803

show more ...


# 87ac65a9 18-Jan-2024 madanial0 <118996571+madanial0@users.noreply.github.com>

[flang] Match the length size in comparison (NFC) (#78302)

The template function call CheckDescriptorEqInt((exitStat.get(), 127) is
deduced to have INT_T equal to std::int32_t instead of std::int64

[flang] Match the length size in comparison (NFC) (#78302)

The template function call CheckDescriptorEqInt((exitStat.get(), 127) is
deduced to have INT_T equal to std::int32_t instead of std::int64_t, but
the length descriptor points to a 64-byte storage. The comparison does
not work in a big endian.

Co-authored-by: Mark Danial <mark.danial@ibm.com>

show more ...


# 8b6b882f 15-Jan-2024 Kelvin Li <kkwli@users.noreply.github.com>

[flang] allow _POSIX_SOURCE to be defined without a value (#78179)

The `_POSIX_SOURCE` macro is defined without a value on AIX. Change the check to `defined(_POSIX_SOURCE)`.


# 4aa04245 15-Jan-2024 Peter Klausler <35819229+klausler@users.noreply.github.com>

[flang][runtime] Clean up code to unblock development (#78063)

Clean up recently-added code to avoid warnings and to eliminate a
needless dependence from the Fortran runtime support library on C++

[flang][runtime] Clean up code to unblock development (#78063)

Clean up recently-added code to avoid warnings and to eliminate a
needless dependence from the Fortran runtime support library on C++
runtimes.

show more ...


# fb094471 11-Jan-2024 Kazu Hirata <kazu@google.com>

[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]


# 731b2956 11-Jan-2024 Rainer Orth <ro@gcc.gnu.org>

[flang] Handle missing LOGIN_NAME_MAX definition in runtime (#77775)

18af032c0e16252effeb6dfd02113812388f1d31 broke the Solaris build:
```
/vol/llvm/src/llvm-project/dist/flang/runtime/extensions.

[flang] Handle missing LOGIN_NAME_MAX definition in runtime (#77775)

18af032c0e16252effeb6dfd02113812388f1d31 broke the Solaris build:
```
/vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:60:24: error: use of undeclared identifier 'LOGIN_NAME_MAX'
60 | const int nameMaxLen{LOGIN_NAME_MAX + 1};
| ^
/vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:61:12: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
61 | char str[nameMaxLen];
| ^~~~~~~~~~
/vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:61:12: note: initializer of 'nameMaxLen' is unknown
/vol/llvm/src/llvm-project/dist/flang/runtime/extensions.cpp:60:13: note: declared here
60 | const int nameMaxLen{LOGIN_NAME_MAX + 1};
| ^
```
`flang/unittests/Runtime/CommandTest.cpp` has the same issue.

As documented in Solaris 11.4 `limits.h(3HEAD)`, `LOGIN_NAME_MAX` can be
undefined. To determine the value, `sysconf(3C)` needs to be used
instead.

Beside that portable method, Solaris also provides a non-standard
`LOGNAME_MAX` which could be used, but I've preferred the standard route
instead which would support other targets with the same issue.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

show more ...


# 959a430a 11-Jan-2024 Yi Wu <43659785+yi-wu-arm@users.noreply.github.com>

[flang] FDATE extension implementation: get date and time in ctime format (#71222)

reference to gfortran fdate
https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
```fortran
CHARACTER(32)

[flang] FDATE extension implementation: get date and time in ctime format (#71222)

reference to gfortran fdate
https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
```fortran
CHARACTER(32) :: time
CALL fdate(time)
WRITE(*,*) time
```

fdate is used in the ECP proxy application
https://proxyapps.exascaleproject.org/app/minismac2d/

https://github.com/Mantevo/miniSMAC/blob/f90446714226eeef650b78bce06ca4967792e74d/ref/smac2d.f#L1570

`fdate` now produce the same result on flang, compare to gfortran, where
If the length is too short to fit completely, blank return.
```fortran
character(20) :: string
call fdate(string)
write(*, *) string, "X"
```
```bash
$ ../build-release/bin/flang-new test.f90
$ ./a.out
X
```
If length if larger than it requires(24), fill the rest of buffer space.
```fortran
character(30) :: string
call fdate(string)
write(*, *) string, "X"
```
```bash
$ ../build-release/bin/flang-new test.f90
$ ./a.out
Wed Nov 15 16:59:13 2023 X
```
The length value is hardcoded, because:
```c++
// Day Mon dd hh:mm:ss yyyy\n\0 is 26 characters, e.g.
// Tue May 26 21:51:03 2015\n\0
```
---------

Co-authored-by: Yi Wu <yiwu02@wdev-yiwu02.arm.com>

show more ...


# e2b896aa 10-Jan-2024 Yi Wu <43659785+yi-wu-arm@users.noreply.github.com>

[flang] Add EXECUTE_COMMAND_LINE runtime and lowering intrinsics implementation (#74077)

This patch add support of intrinsics Fortran 2008 EXECUTE_COMMAND_LINE.
The patch contains both the lowering

[flang] Add EXECUTE_COMMAND_LINE runtime and lowering intrinsics implementation (#74077)

This patch add support of intrinsics Fortran 2008 EXECUTE_COMMAND_LINE.
The patch contains both the lowering and the runtime code and works on
both Windows and Linux. The patch contains a list of commits, to convey
the authorship and the history of changes. Some implementation specifics
or status has been added to `flang/docs/Intrinsics.md`.

I have provided a summary of the usage and the options required for the
`EXECUTE_COMMAND_LINE intrinsic`. The intrinsic supports both a
synchronous
(by default) and an asynchronous option.

| System | Mode | Implemention |
|---------|-------|---------------------------|
| Linux | Sync | std::system() |
| Windows | Sync | std::system() |
| Linux | Async | fork() |
| Windows | Async | CreateProcess |

Support for the SYSTEM GNU extension will be added in a separate PR.

Co-authored with @jeffhammond

---------

Signed-off-by: Jeff Hammond <jeff.science@gmail.com>
Co-authored-by: Jeff Hammond <jeff.science@gmail.com>
Co-authored-by: Yi Wu <yiwu02@wdev-yiwu02.arm.com>

show more ...


# 18af032c 21-Dec-2023 Yi Wu <43659785+yi-wu-arm@users.noreply.github.com>

[flang] add GETLOG runtime and extension implementation: get login username (#74628)

Get login username, ussage:
```
CHARACTER(32) :: login
CALL getlog(login)
WRITE(*,*) login
```
getlog is re

[flang] add GETLOG runtime and extension implementation: get login username (#74628)

Get login username, ussage:
```
CHARACTER(32) :: login
CALL getlog(login)
WRITE(*,*) login
```
getlog is required for an exascale proxyapp.
https://proxyapps.exascaleproject.org/app/minismac2d/

https://github.com/Mantevo/miniSMAC/blob/f90446714226eeef650b78bce06ca4967792e74d/ref/smac2d.f#L615

https://github.com/Mantevo/miniSMAC/blob/f90446714226eeef650b78bce06ca4967792e74d/ref/smac2d.f#L1570

---------

Co-authored-by: Yi Wu <43659785+PAX-12-WU@users.noreply.github.com>
Co-authored-by: Yi Wu <yiwu02@wdev-yiwu02.arm.com>
Co-authored-by: Kiran Chandramohan <kiranchandramohan@gmail.com>

show more ...


# 8d0fb9f6 06-Dec-2023 kkwli <kkwli@users.noreply.github.com>

[flang] Make the length size matched in comparison (NFC) (#73280)

The template function call `CheckDescriptorEqInt(length.get(), 16)` is
deduced to have `INT_T` equal to `std::int32_t` instead of

[flang] Make the length size matched in comparison (NFC) (#73280)

The template function call `CheckDescriptorEqInt(length.get(), 16)` is
deduced to have `INT_T` equal to `std::int32_t` instead of
`std::int64_t`, but the length descriptor points to a 64-byte storage.
The comparison does not work in a big endian.

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5
# de58aa83 13-Nov-2023 Yi Wu <43659785+PAX-12-WU@users.noreply.github.com>

[flang] GETPID runtime and lower intrinsic implementation (#70442)

Runtime function GetPID calls the function getpid
from unistd.h or process.h base on the OS.


Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# ffc67bb3 02-Oct-2023 David Spickett <david.spickett@linaro.org>

Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's runtime LLVM integration"

This reverts commit 6403287eff71a3d6f6c862346d6ed3f0f000eb70.

This is failing on all but 1 of Li

Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's runtime LLVM integration"

This reverts commit 6403287eff71a3d6f6c862346d6ed3f0f000eb70.

This is failing on all but 1 of Linaro's flang builders.
CMake Error at /home/tcwg-buildbot/worker/clang-aarch64-full-2stage/llvm/flang-rt/unittests/CMakeLists.txt:37 (message):
Target llvm_gtest not found.

show more ...


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# 48b5a06d 19-Jan-2023 Leandro Lupori <leandro.lupori@linaro.org>

[flang] Single entry point for GET_ENVIRONMENT_VARIABLE

This patch refactors the runtime support for GET_ENVIRONMENT_VARIABLE
to have a single entry point instead of 2. It also updates lowering
acco

[flang] Single entry point for GET_ENVIRONMENT_VARIABLE

This patch refactors the runtime support for GET_ENVIRONMENT_VARIABLE
to have a single entry point instead of 2. It also updates lowering
accordingly.

This makes it easier to handle dynamically optional arguments.
See also https://reviews.llvm.org/D118777

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D142489

show more ...


Revision tags: llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# 0ec3ac9b 19-Jul-2022 Jonathon Penix <jpenix@quicinc.com>

[Flang] Add -fconvert option to swap endianness for unformatted files.

To accomplish this, this patch creates an optional list of environment
variable default values to be set by the runtime to allo

[Flang] Add -fconvert option to swap endianness for unformatted files.

To accomplish this, this patch creates an optional list of environment
variable default values to be set by the runtime to allow directly using
the existing runtime implementation of FORT_CONVERT for I/O conversions.

show more ...


# eb7a02ea 01-Jul-2022 Diana Picus <diana.picus@linaro.org>

[flang] Single entry point for GET_COMMAND_ARGUMENT

This patch refactors the runtime support for GET_COMMAND_ARGUMENT to
have a single entry point instead of 2. It also updates lowering
accordingly.

[flang] Single entry point for GET_COMMAND_ARGUMENT

This patch refactors the runtime support for GET_COMMAND_ARGUMENT to
have a single entry point instead of 2. It also updates lowering
accordingly.

This makes it easier to handle dynamically optional arguments. See also
https://reviews.llvm.org/D118777

Differential Revision: https://reviews.llvm.org/D130475

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1
# 873f081e 02-Feb-2022 Diana Picus <diana.picus@linaro.org>

[flang] Add runtime support for GET_COMMAND

Implement the GET_COMMAND intrinsic.
Add 2 new parameters (sourceFile and line) so we can create a terminator
for RUNTIME_CHECKs.

Differential Revision:

[flang] Add runtime support for GET_COMMAND

Implement the GET_COMMAND intrinsic.
Add 2 new parameters (sourceFile and line) so we can create a terminator
for RUNTIME_CHECKs.

Differential Revision: https://reviews.llvm.org/D118777

show more ...


# 73b193ae 16-Feb-2022 Peter Klausler <pklausler@nvidia.com>

[flang] Allow more concurrently open NEWUNIT= values, with recycling

Add a header-only implementation of Briggs & Torczon's fast small
integer set data structure to flang/include/flang/Common, and u

[flang] Allow more concurrently open NEWUNIT= values, with recycling

Add a header-only implementation of Briggs & Torczon's fast small
integer set data structure to flang/include/flang/Common, and use
it in the runtime to manage a pool of Fortran unit numbers with
recycling. This replaces the bit set previously used for that
purpose. The set is initialized on demand with the negations of
all the NEWUNIT= unit numbers that can be returned to any kind
of integer variable.

For programs that require more concurrently open NEWUNIT= unit
numbers than the pool can hold, they are now allocated with a
non-recycling counter. This allows as many open units as the
operating system provides.

Many of the top-line comments in flang/unittests/Runtime had the
wrong path name. I noticed this while adding a unit test for the
fast integer set data structure, and cleaned them up.

Differential Revision: https://reviews.llvm.org/D120685

show more ...


Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# 9df0ba59 27-Oct-2021 Diana Picus <diana.picus@linaro.org>

[flang] Implement GET_ENVIRONMENT_VARIABLE(VALUE)

Implement the second entry point for GET_ENVIRONMENT_VARIABLE. Reuse
existing bits and pieces wherever possible.

This patch also increases CFI_* er

[flang] Implement GET_ENVIRONMENT_VARIABLE(VALUE)

Implement the second entry point for GET_ENVIRONMENT_VARIABLE. Reuse
existing bits and pieces wherever possible.

This patch also increases CFI_* error codes in order to avoid conflicts.
GET_ENVIRONMENT_VARIABLE is required to return a status of 1 if an
environment variable does not exist and 2 if environment variables are
not supported. However, if we add status codes for that they will
conflict with CFI_ERROR_BASE_ADDR_NULL and CFI_ERROR_BASE_ADDR_NOT_NULL,
which are also 1 and 2 at the moment. We therefore move all CFI error
codes up (an arbitrary) 10 spots to make room. Hopefully this isn't
a problem, since we weren't matching the CFI error codes that gfortran
uses anyway. It may still be an issue if any other runtime functions
will need to return a status of 1 or 2, but we should probably deal with
that when/if it occurs.

Differential Revision: https://reviews.llvm.org/D112698

show more ...


12