<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76920>76920</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang reapeatedly calls emitDwarfDIE and giving SIGSEGV: invalid memory reference error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sundeep-kokkonda
</td>
</tr>
</table>
<pre>
While building rust sources (in Yocto distro for custom target - _i686-poky-linux-gnu_), when the 'p384' crate compiling we are getting '_signal: 11, SIGSEGV: invalid memory reference_' error. This issue is occurring when build is for **32-bit architecture machines with DEBUG enabled**.
Initially it was seen with LLVM version: 16.0.5 and we could reproduce the issue with LLVM version: 17.0.4.
Below is the error text with LLVM version: 17.0.4:
```
error: rustc interrupted by SIGSEGV, printing backtrace
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x9ea726)[0x7ff413b9f726]
/home/skokkonda/00_Work/12360/poky/build/tmp/sysroots-uninative/x86_64-linux/lib/libc.so.6(+0x391f0)[0x7ff412de91f0]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2e15dbe)[0x7ff415fcadbe]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2e15f01)[0x7ff415fcaf01]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2e15fb6)[0x7ff415fcafb6]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2e7d7d9)[0x7ff4160327d9]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2cdccf9)[0x7ff415e91cf9]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2c64abe)[0x7ff415e19abe]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x2cda7c4)[0x7ff415e8f7c4]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1afe8b3)[0x7ff414cb38b3]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b2300b)[0x7ff414cd800b]
### cycle encountered after 11 frames with period 12
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
### recursed 20 times
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
/home/skokkonda/00_Work/12360/mini/recipe-sysroot-native/usr/bin/../lib/librustc_driver-af0ab23c1eb07079.so(+0x1b23bc8)[0x7ff414cd8bc8]
```
rust version info:
```
rustc 1.74.1 (a28077b28 2023-12-04) (built from a source tarball)
binary: rustc
commit-hash: a28077b28a02b92985b3a3faecf92813155f1ea1
commit-date: 2023-12-04
host: x86_64-unknown-linux-gnu
release: 1.74.1
LLVM version: 17.0.4
```
This we've discussed in rust community - https://github.com/rust-lang/rust/issues/113612#issue-1800304589 and, we suspect that the issue is from llvm function - **llvm::AsmPrinter::emitDwarfDIE(llvm::DIE const&) const**
The gbd back trace is here - https://github.com/rust-lang/rust/issues/113612#issuecomment-1634327291
The attached 'p384.zip' contains the llvm-ir file.
[p384.zip](https://github.com/llvm/llvm-project/files/13827811/p384.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsmV1v47gVhn8NfXMggR_6vPBFMh4PBtgCBbbdRa8Cijyy2EikQVJJ3F9fUHKS8czsogO0hXdhwFCsVzrUcw4PE-WlDMEcLOKWlPek3G3kHAfnt2G2GvGYPbrHR2e13HROn7a_DmZE6GYzamMP4OcQIbjZKwxAeGMs_MOp6ECbEL2D3nlQc4hugij9ASNk8GCqpsqO7vGUjcbOL9nBzg-Et4R_gOcBLcQBgfD6KJqC8BqUlxFBueloxvTMZwTpEQ4YYzolvH5ICciRiDtgLA3z8-dPP3_89EsSjH2So9Ew4eT8CTz26NEqfEhDo_fO5_C3wQQwIcwIJoBTavZ-eVKiWXJNesqF8DvC7wTPOhNBejWYiCrOHmGSajAWAzybOMDu4_3fPwFa2Y2o16Cc0B2hd-vxszXRyHE8gYnwLAMERLuG_vTTL3-BJ_TBOLtkVOU0L0FanTJXbh41eDx6p2eFS61W8u8H1znNi4tH3-PonlM-KXQpAER8ib8XT8Q5llT0_FlOl-h0W2oDBcZG9H4-RtTQnd4mgX-Aozd2maxOqsfopcLzeHw_uAkJ34fXNiN8T-nDr84_Er5nXFSU8P1krCF871GZI2bhFLxzMbMymqcUPAdP-L4zlvB9nhO-H023HhewB-3NE_pM9lR2XCiGHa1p3ebBEd4Qfk9fWpQ1r1ITlvf0pe77gomu7ZNW7n6MNTV2okltQ_g-TscUsiKHbLbmDfulqR6qYl0EX0KrPLi8ekUTLevpBRnXuGg_SvY_ryJHVuoOL2DLXsmkXSVsT9k3sEm7Ttiu-ha2-_EG_T_A1rrW7QVsRQVP2vXBKq1UfwlbYsuSdoWwVSG_XmDIWnmVC0xpWaviK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