https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67260
Bug ID: 67260 Summary: [sh] Register spill bug for sibcall+complex+softfloat Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bugdal at aerifal dot cx Target Milestone: --- Created attachment 36205 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36205&action=edit Preprocessed C source file demonstrating the bug cacoshl() from musl's complex math library produces an error with all versions of GCC tested, up through 5.2.0, when sibcall optimization is enabled: src/complex/cacoshl.c: In function 'cacoshl': src/complex/cacoshl.c:7:1: error: unable to find a register to spill in class 'SIBCALL_REGS' } ^ src/complex/cacoshl.c:7:1: error: this is the insn: (call_insn/j 12 11 13 2 (parallel [ (set (reg:DC 0 r0) (call (mem:SI (symbol_ref:SI ("cacosh") [flags 0x43] <function_decl 0x7f754b09aca8 cacosh>) [0 cacosh S4 A32]) (const_int 0 [0]))) (use (reg:SI 154 fpscr0)) (clobber (scratch:SI)) (return) ]) src/complex/cacoshl.c:6 335 {sibcall_value_pcrel} (expr_list:REG_DEAD (reg:SI 154 fpscr0) (expr_list:REG_DEAD (reg:DC 4 r4) (expr_list:REG_CALL_DECL (symbol_ref:SI ("cacosh") [flags 0x43] <function_decl 0x7f754b09aca8 cacosh>) (nil)))) (expr_list:DC (use (reg:DC 4 r4)) (nil))) src/complex/cacoshl.c:7: confused by earlier errors, bailing out Using -fno-optimize-sibling-calls makes the error go away. The error also does not occur on sh4 (in the default configuration), which has fpu, only on sh2 with soft-float. I'm attaching the preprocessed output of cacoshl.c that can be used to reproduce the error. I don't have a simpler testcase at the moment.