panic in PPC NCG
I get panics in the NCG PPC register allocator while compiling these files:
rts_dist_HC rts/dist/build/StgStdThunks.dyn_o
rts_dist_HC rts/dist/build/StgStdThunks.thr_dyn_o
rts_dist_HC rts/dist/build/StgStdThunks.l_dyn_o
rts_dist_HC rts/dist/build/StgStdThunks.thr_l_dyn_o
HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Classes.o
HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/CString.o
HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Debug.o
The panic message is like this:
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 7.7.20130405 for powerpc-montavista-linux):
allocateRegsAndSpill: Cannot read from uninitialized register
%vI_nff
This makes the bootstapping of PPC cross compiler, ehm, delicate.
There is a comment in compiler/nativeGen/RegAlloc/Linear/Main.hs:756
Nothing | reading ->
pprPanic "allocateRegsAndSpill: Cannot read from uninitialized register" (ppr r)
-- NOTE: if the input to the NCG contains some
-- unreachable blocks with junk code, this panic
-- might be triggered. Make sure you only feed
-- sensible code into the NCG. In CmmPipeline we
-- call removeUnreachableBlocks at the end for this
-- reason.
So we have a 'junk code' issue here.
Any hints how I can debug this?