<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64436>64436</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Incorrect builtins are exposed for offload targets
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
AaronBallman
</td>
</tr>
</table>
<pre>
When using `-aux-triple` for an offload target, the incorrect builtins are being exposed. The builtins exposed are not based on the target specified. e.g,
```
static_assert(__has_builtin(__cpuidex), "uh oh");
```
will not fail when given: `-c -fopenmp -Xclang -fopenmp-is-target-device -Xclang -aux-triple -Xclang x86_64-unknown-linux-gnu`, but it should fail because that's a Windows-specific builtin. Removing the `-aux-triple` will cause the assertion to trigger as expected.
https://godbolt.org/z/sbMjjer16
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk02P4ygQhn8NvpRsYfyR5OBDOq1Ie9jLaqWeW4ShbNNDwOIjycyvH0HSHc1MS5YtCvxW1fMW3Hs1G8SBdC-key14DIt1w547a1641mduitHKH8PbggaiV2YG0tOSx1sZnFo1kp7CZB1wA3aatOUSAnczBsIOEBYEZYR1DkWAMSodlPHAHcKISQtvq_UoK_h_wef-I5rPGRtg5GllTda7q4NfUahJpX-xmgk7EPpK6J709PHkpQ88KHHi3qMLhG1Pp4X70yNRXos1Kok3wnapYMJYXMAuhLEUaV6-VL0qrXNhE1cargnNrC5oSLPPdASUk13RnFcovwnNzfwZKJUv7x2UEi9K4PPEk-ln7LbtT31bRvPd2KsptTLxVs4mpkrYAcYYQAXwi41a3osZUfDoEcLCA2EbDxzelJH26ssHMfHBuYL_8GwvyYbE9W9bc5sfcgh3iCrZYCE4Nc_ogGe3UASU1YNVfi8hrJ40e8KOhB1nK0erQ2XdTNjxJ2FHP_77_o6u7gs5NHLX7HiBQ93v6nrTMdoVy9DIepx62vabLRVYT5SKrtlI3rVTTbc4FmpglDV0S9t62zWsq-RG1FO727Gm50JsOWkpnrnSldaXc8pdKO8jDn3bNn2h-Yja58FnbIxztvxAGMvoSbOfnDUBjUwb3WvhhiRTjnH2pKVa-eCfwkEFjcM_X4_6xzina_L7HfFFdHr4g5UKSxwrYc-EHVOCx6dcnX1HEQg75jY8Ycfcya8AAAD__x-3PQI">