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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Oct 31 09:05:37 PDT 2023


klausler wrote:

> > `getpid` needs to be defined as an intrinsic function in order to get its result type correct.
> 
> How can I define it as intrinsic function to get a correct result type? I have tried renaming `iargc` to `argc` in `extension.cpp`, it will be called as `call contract float @argc_()`. @klausler I've defined `getpid` in `flang/lib/intrinsics.cpp` and `flang/lib/optimizer/builder/intrinsicsCall.cpp`. However, if it's defined in `extension.cpp`, which only calls a runtime function in `flang/runtime/command.cpp`, how does the intrinsic function affect the return type in `extension.cpp`?
> 
> I initially tried in `extension.cpp` but it didn't work due to reason mention above, so I switched to do in it `intrinsics` and `instrinsicsCall.cpp`. I still don't understand why adding/remove an `i` would have such effect in `estension.cpp`

Types are determined in semantics.  By default, in Fortran, a name with no explicit type is integer if its first letter is in the range I through N, and real otherwise.

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


More information about the flang-commits mailing list