[flang] Support lowering of intrinsic module procedure `c_loc`
As Fortran 2018 18.2.3.6, the intrinsic `c_loc(x)` gets the C address of argument `x`. It returns the scalar of type C_PTR. As defined in iso_c_binding in `flang/module/__fortran_builtins.f90`, C_PTR is the derived type with only one component of integer 64. This supports the lowering of intrinsic module procedure `c_loc` by converting the address of argument into integer 64, where the argument is lowered as Box and the address is generated using fir.box_addr. The lowering of intrinsic `c_funloc` has the similar characteristic and will be supported later. The execution tests for various data types are in issue https://github.com/llvm/llvm-project/issues/56552. Reviewed By: Jean Perier Differential Revision: https://reviews.llvm.org/D129659
Loading
Please sign in to comment