<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58413>58413</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
DW_OP_GNU_entry_value and DW_OP_entry_value emitted even with options that should prevent it
</td>
</tr>
<tr>
<th>Labels</th>
<td>
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
john-brawn-arm
</td>
</tr>
</table>
<pre>
DW_OP_entry_value is a DWARF expression that was added in DWARF 5, and DW_OP_GNU_entry_value is a GNU extension that behaves the same. When compiling with `-gdwarf-4` clang should not emit DW_OP_entry_value but is allowed to use DW_OP_GNU_value, and when using `-gdwarf-4 -gstrict-dwarf` it should emit neither.
An example where we do this:
```
int a, b;
void c();
void d(void *) {
c();
b = a;
}
```
When compiled with `-O1 -gdwarf4 -gstrict-dwarf` (with either `--target=aarch64` or `--target=amd64`) the .debug_loc section contains DW_OP_GNU_entry_value. Additionally using `-glldb` we get DW_OP_entry_value. I _think_ what we should be doing instead is just not emitting a location expression for the address range that's covered by the DW_OP_GNU_entry_value/DW_OP_entry_value.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU1GP2jAM_jXpi9WqLZTCQx-4oZv2spsmTfeIksa0uYUEJSmMfz8nwI4JpKpNbNffZ3-2sPLcbd63bz-2aII7b49cTwjKA4fN-_rnK-Cfg0PvlTUQRh7gxMknJUpQ5hrSsPoLcCPhkujr91-PychIqQKaz0wCR35ETxcEz_dYwPuIBnq7PyitzAAnFUZgizIf5Im7XT6nM_Sak8uPdtISjA2AexXgsQQxhYSstT0R2WBh8njHMEXdiJ8i8OQj6D0e5IMPTvUhT4YIT1hX7IRrkDiiK1i5YeX68l4bqpTvDxpjXkdvBGmpTOXZ7BpDqa5PuioTgEcygs1eLqajVRJ6Vi9ZvfrfKMmYDqxekxNYe_XCQzyAADbbUO6bhbWbpwzuWk_d-tf5twqu3XjWDEJLkZcmpB_ywN2AgUA5d_24SJrZB99eJk-kH-UvJIpp2Grbg8c-xBHprQlcGf98qApYS6liIAl8vpdOaykiJjWdsB4Ho4BvsCUtzO8tyRMHGm-KiqhTTESwAbmM8_Mx-fBvzEJ0ciCaPHG8240d1RgrodWIJnA0pZjmnNWtp2qONAkEcU5RT2ti9esj2wy7arFYlNWybupMdjO5mq14FlTQ2D3ft89NvLcm_sQAjyR0Us0eYhH-sozXFlA95KfNCdnkdDeGcEhDW7_SM9BfkyhoSuii9fH2yQ_OfpBsdFXeT-jp0Czn1Swbu35eLnfVAvmyXjZtI7AUQrZ8taiqFuftKtNcoPYda15YXacxUGZn6cyaTaa6uqzrqqzaat6UTV2IVbUrBa_kjPc7OedsXuKeK11EHoV1Q-a6RInyeHJq5YP_dHISazCICY7y8ymM1nUfdjS5cPxkcu72WSqiSxX8BcGyrbA">