Ok, I think I got it; it's src/thread.c. The following build succeeds:
git clean -xdf
git checkout emacs-29.0.92
./autogen.sh
./configure --with-native-compilation
cd src
make temacs.exe
make thread.o -W thread.c CFLAGS='-g3 -O2 -gdwarf-2 -fno-optimize-sibling-calls'
cd ..
make
I first compile temacs.exe with CFLAGS at default and then rebuild
thread.c with -fno-optimize-sibling-calls. This way thread.c should be
the only file built with the flag. Conversely, compiling with
-fno-optimiize-sibling-calls everywhere *but* thread.c fails:
git clean -xdf
git checkout emacs-29.0.92
./autogen.sh
./configure --with-native-compilation
cd src
make temacs.exe CFLAGS='-g3 -O2 -gdwarf-2 -fno-optimize-sibling-calls'
make thread.o -W thread.c
cd ..
make CFLAGS='-g3 -O2 -gdwarf-2 -fno-optimize-sibling-calls'
> Using make -j1 (or even better make bootstrap -j1) should make it
> reproducible.
> make LD_SWITCH_SYSTEM='-Wl,--disable-dynamicbase'
>
> Maybe this will make the bug less unpredictable, who knows?
Tried them, the failing lisp files still seem random.