https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81426
--- Comment #9 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Sergei Trofimovich from comment #7) > Not sure if it's the same bug or not, but I get the same error building GHC "unable to find a register to spill in class 'R0_REGS'" ... kind of errors are all the same type of "bug" -- the old register allocator of GCC can't deal with the R0 restriction of certain SH instructions well in some cases. Unfortunately, there's no simple fix for it that I know of. You can try to use the new register allocator with the option -mlra on a selective basis, because it's got its own set of issues on SH.