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

Yi Wu via flang-commits flang-commits at lists.llvm.org
Mon Oct 30 06:07:40 PDT 2023


PAX-12-WU wrote:

I have tried to implement it in `flang/runtime/extension`
```c++
// RESULT = GETPID()
pid_t FORTRAN_PROCEDURE_NAME(getpid)() { return RTNAME(GetPID)(); }
```
However, when testing getpid in a file, getpid would return a `float` rather than an `i32`, the same applies even if I change the return type from `pid_t` -> `std::int32`.
There is a workaround, by renaming the function from `getpid` -> `igetpid`
|...| Before  |  After |
|---|---|---|
| fuc name  | getpid  | igetpid  |  
| -S -emit-llvm  | ` %3 = call contract float @getpid_()`  | `%3 = call i32 @igetpid_()` | 


https://github.com/llvm/llvm-project/pull/70442


More information about the flang-commits mailing list