<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56552>56552</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Implementation status of Fortran 2003 intrinsic module procedure `C_LOC`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            PeixinQiao
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          PeixinQiao
      </td>
    </tr>
</table>

<pre>
    1. 18.2.3.6 C_LOC (X)
2. Description: C address of the argument.
3. Argument: X shall have either the POINTER or TARGET attribute. It shall not be a coindexed object. It shall
be a variable with interoperable type and kind type parameters, an assumed-type variable, or a nonpolymorphic
variable that has no length type parameter. If it is allocatable, it shall be allocated. If it is a pointer, it shall be
associated. If it is an array, it shall be contiguous and have nonzero size. It shall not be a zero-length string.
4. Result Characteristics. Scalar of type C_PTR.

## gfortran
Only support pointer or target attribute
## ifort
support non-pointer/allocatable variables. Do not support printing C_PTR (component is private).

## Test script
#!/bin/bash

echo && echo "---------flang-new---------"
flang-new a.f90 -c
clang b.c -c -w
flang-new -flang-experimental-exec a.o b.o
./a.out

echo && echo "---------gfortran---------"
gfortran a.f90 -c
gcc b.c -c -w
gfortran a.o b.o
./a.out
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMtu2zoQ_Rp5MzChh-XYCy1SpykCFDe5uV50V1DUWGJLkwJJJXG__g4pyXHdLGoIkjnPc2Y4U5vmVGUMsg3LWcHWsPv-9XEHSb75luTbJL1L0tucwR06YWXvpdFJcQs74E1j0TkwB_AdArftcETt2ehRMLidJMH8G7iOKwUdf0FASQ42ej09Pvyz__wMxsL-9vnL5z1w762sB48MHvzkpY2HmlKAMFI3-IYNmPoHCv9uM2aNRi_cSl4rhFfKA1J7tKZHG0X-1JOJbuAnBRpPPbf8iGTkkpxYaeDOEe5mGbVzsKAjkJyw6N6o09HYvpNiTHvO6DvuiaMjK1CoW8r_ew4CfADpQTog0EZwPweXM9nAYVRhc2kOvYlcroxHBITZCHntQlys5afr8MJoL9vBDC6WIvaEaP2iOoGTvz6sfFAuJ0qOOqTbqdErBs_oBuVh1xFLQQil81I4Bv8JrriNFyQUYff9af88eU3vvKAH2oOx3nI9Ch-1OoEb-p6EM-dQek83DP37_fgthAwhRsnsSoyW55LdX1T73FOCeGcixXM6IuaJ24g1zIAwx95ousWhoKR-oRrTWHxEY4-OIsUhuZBnlLyWOry56y7dUHSGUqzpgel_vpx_B8V1u9T4epaQdvQ7q4CzwzaF5XQLRZBDzQRJYPl6bTyFxDeaBRnmkis6oKAohrzMaM9CrZgZ_F8jnbv3J9BZc4WzFeIa5YXlR1gWTVU022LLF156hdXDsVcYKYR1RPeR-yEuovspTJ6mRZh8aqeTAo6mGajvvTUCm8EiJOs0bjn6Lgarqs773tGeooT0tLQ3BkJojnRQ6mX-LClA2Dp0lLQjkBbGfbkuy3zRVU2-StflapuusoyX2816JQqss2yTbbPDIasXiteoXJWUn6g-sRWhTuXdQlZ5mufpTVZmN2WWFWyTlcVhfbMRN-tsw4syWaV45FKxgIEZ2y5sFeHUQ-tIqWje3LuSVoFsNeKU6gnlm9T_Sm6mfHzwnbHVu3wRyVSRyf_aDO7b">