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

    <tr>
        <th>Summary</th>
        <td>
            [flang] error: No explicit type declared for '__builtin_c_ptr' in when reading module file using c_null_ptr default values
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            flang:frontend
      </td>
    </tr>

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

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

<pre>
    Initially reported by @rj-jesus when compiling https://github.com/Nicholaswogan/fortran-yaml-c

Repro:
```
! in some_module.f90
module some_module
  use iso_c_binding
  type :: t
    type(c_ptr) :: string = c_null_ptr
  end type
end module
```

`flang-new -c some_module.f90` goes OK.

```
! in foo.f90
subroutine foo    
  use some_module   
end subroutine
```
`flang-new -c foo.f90` hits a bogus error:
```
./some_module.mod:58:21: error: No explicit type declared for '__builtin_c_ptr'
 type(c_ptr)::string=__builtin_c_ptr(__address=0_8)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVNuOmzAQ_RrzMkoENpfwwEPaKFJVaVv1B5DBA3FkbOTLbvP3lSFp0uy2L5WioDnD8cyc44E7J0eN2JDiEykOCQ_-ZGxzRq6_o5Vok86IS_NFSy-5UhewOBvrUUB3AZKn9rw5owsO3k6ooTfTLJXUI5y8nx1he0KPhB5H6U-h2_ZmIvT4IvuTUdy9mZFrQo-Dsd5yvbnwSW16kh5Iul__f-BsTTxkxcr0-ltDmoHU4MyE7WREULgd6mtujR9zKw4QHIJ0pu3bTmoh9XhL-MuMEGuxPfgbuMKE7vp29pbQ-vaG8zZOSdgB-lYHpZb8lYVarLwljtFjD89j3MBBcT1uNL7Bpn83VZnCaNDBt6_bJ9oHkgzG3KVwobMmeKkx4nGkRyke6vzOxIbvrI8LPbV7q1imcJLeAYfOjMEBWmvs3wzcEnp8nHMygrB9sSNsT7Mo8o0NLwbw56xkL_3qk8BecYsCBmOB0KptuyCVl7q9GlVdh3yyb3VvNY-wwzvarm25EBadI-yQtrtI-bP1RDRM1KzmCTZZWZc5y1hRJKemyLOuqytkNKNYFoJh3pUCh7SqCp7WLJENTSnL0jTP8qIosi12dUczWpRV1Vesrkie4sSl2ir1Om2NHRPpXMCm3FFaJop3qNyyppR2YSSUEvqZULoYQdh-sEZ71CImikNim3jMpgujI3mqpPPufrCXXi0rv5KLw39pHe_csv4WeVyp63WHQSqE4CJyXxIQOPCgPLxyFdAlwarmHx-L2PL1sZmtOWPvCT0uwjhCj4s2vwIAAP__Aod4Dg">