<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56660>56660</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Preserve a pointer type for extern functions in SPIR-V
</td>
</tr>
<tr>
<th>Labels</th>
<td>
opaque-pointers
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AnastasiaStulova
</td>
</tr>
</table>
<pre>
This issue has been discussed in details in: https://reviews.llvm.org/D127579
Due to the transition to the untyped pointers, clang can no longer support compiling extern functions with pointer types in the prototype.
Example:
**test1.cl**
extern void foo(int * ptr);
kernel void k(int * ptr) {
foo(ptr);
}
**test2.cl**
void foo(int * ptr){
*ptr = 1;
}
Linking SPIR-V binaries obtained from those files results in an error:
`error: 0: Type mismatch on symbol "foo" between imported variable/function %6 and exported variable/function %17.`
Because reconstructed types appear to be mismatching.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U01vnDAQ_TXmMgoCw8Jy4JB0G6lSD1ET9W7M7OLG2NQfm-Tfd4Ddbj6USAjw-Hnm-c2bzvYv7cOgPCjvI8IgPHSIBnrlZfQee1C0wCCUJoxhxTUMIUyefhi_pcfhUeGTT7U-jql1Bwrtcl5v6oZlO5Zdr-8d5Q4WwkAfJ4xXQVlzjkQTXiaqNFllAjrP-DeQWpgDSGHAWNDWHNCBj9NkXQBpx0lpRfv4THgD-2jknNDDkwrDOQ_MWWfSS5HJ2WDnSPqa1_dnMU4a59usUT4_AX3IU6nX1Wv8qeDRqh721jK-pVJAIJiCY7xhxc0KfCQY6hX4-AEGrD7h4JTm3XFW716XvdDi72h9zuRSgYIUA1bsIP-swk9lHmdF7-9-_Lr6DZ0ywilSz3bUekPN2Ts7kpDWI-yVph2HPuqw6EtdQuesu8hYZecAZPPrgYSHUflRBDkAtd6_jJ3VRI0v5Dm5LjzNxlPj3GMqeCQCoqPe8Ntzfwm-qahaT43_GpXXKXFYydygFJFoO5RkkeCinA-u5hDThMLNRuwu_EiHNOnbom-KRiRBBY3tHV0X3RFBvLEXSe8-upAkWXVMotPt23k5kENjl5KHaTEPzelzRQb9gzLQchlFmoLbTVVVWTK027Lstxk2yAvZ9FWT1bnk-6bJi6bhXdUlWnSofcs2NySlncTfiFeXaeJss0tUyzPOs5rnebXhZZZ2jcgqWe7LrBD5ti9ZmeFIY_5_khPXLsS6ePC0qZUPlzFPhPfqYBCXopRfRDKHa6-N8EF4Je5D1PYokuUy7XKTf4HDayQ">