https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108250
Bug ID: 108250
Summary: [12/13 regression] llvm-tblgen miscompiled on
powerpc-unknown-linux-gnu since
r12-5383-g22c242342e38eb
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sam at gentoo dot org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Host: powerpc-unknown-linux-gnu
Target: powerpc-unknown-linux-gnu
Build: powerpc-unknown-linux-gnu
Originally reported downstream in Gentoo at https://bugs.gentoo.org/880677. I
forwarded it to LLVM at https://github.com/llvm/llvm-project/issues/59698 too.
With GCC 12 and newer, llvm-tblgen (which is built as part of the LLVM build
process and used for part of the build) is miscompiled on
powerpc-unknown-linux-gnu. GCC 11 and older are fine.
It has two failure modes:
1. When producing a description for the PPC target in LLVM as:
```
bin/llvm-tblgen -I ~/llvm-project/llvm/lib/TargetPowerPC \
-I ~/llvm-project/llvm/include/ \
-I ~/llvm-project/llvm/lib/Target/PowerPC/ \
~/llvm-project/llvm/lib/Target/PowerPC/PPC.td \
-o /dev/null \
--gen-dag-isel \
-d /dev/null \
--time-phases \
--write-if-changed
```
it'll regularly hang (not on all runs, but if you run it 10 times, it'll hang
for several of them).
2. For X86, it'll give invalid output which later causes the LLVM compilation
to fail.
For the purposes of tracking down which GCC commit caused it, we bisected by
checking for timeouts in a loop. The result was r12-5383-g22c242342e38eb.
Reverting 22c242342e38ebffa6bbf7e86e7a1e4abdf0d686 on top of releases/gcc-12
(at a3fbfc1027e9edcd14bb290b5702504d80d9e8fe) results in a built llvm-tblgen
which doesn't hang.
Please let me know what further information you require. Access to the
environment is also available (it's purely a testing machine for this kind of
bug, no personal data on it).