------- Comment #15 from ktietz at gcc dot gnu dot org 2009-07-06 17:02 ------- (In reply to comment #14) > > By simply re-ording of arguments fos sibcall_1 and sibcall_value_1, so that > > c > > is last element, produced code is ok and no ICE I've seen. > > Disparaging it ("s,!c,d,a") would be even more robust I think. >
yeah, this works, too. But the d needs the !, too. As when I alter my testcase by giving the dllimport'ed fastcall a second argument, it ICEs again. $ /usr/local/bin/i686-pc-mingw32-gcc.exe -o t.s -S c_impfast2.c -O2 c_impfast2.c: In function 'f': c_impfast2.c:7:1: error: unable to find a register to spill in class 'DREG' c_impfast2.c:7:1: error: this is the insn: (call_insn/j 12 10 13 2 c_impfast2.c:6 (call (mem:QI (reg/f:SI 3 bx [58]) [0 S1 A8]) (const_int 0 [0x0])) 462 {*sibcall_1} (expr_list:REG_DEAD (reg/f:SI 3 bx [58]) (expr_list:REG_DEAD (reg:SI 2 cx) (expr_list:REG_DEAD (reg:SI 1 dx) (nil)))) (expr_list:REG_DEP_TRUE (use (reg:SI 2 cx)) (expr_list:REG_DEP_TRUE (use (reg:SI 1 dx)) (nil)))) c_impfast2.c:7:1: internal compiler error: in spill_failure, at reload1.c:2094 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. So with both c and d changed to !c and !d for sibcall_1 and sibcall_value_1 it translates without ICE to: .file "c_impfast2.c" .text .p2align 4,,15 .globl _f .def _f; .scl 2; .type 32; .endef _f: pushl %ebp movl $1, %edx movl %esp, %ebp movl $2, %ecx pushl %ebx subl $4, %esp movl __i...@h@8, %ebx call *%ebx addl $4, %esp movl $2, %edx movl $1, %ecx movl %ebx, %eax popl %ebx popl %ebp jmp *%eax New patch for i386.md (and you are right the !c,!d is more robust here) is: Index: gcc/gcc/config/i386/i386.md =================================================================== --- gcc.orig/gcc/config/i386/i386.md 2009-07-06 18:14:36.155670000 +0200 +++ gcc/gcc/config/i386/i386.md 2009-07-06 18:53:10.459670100 +0200 @@ -15536,7 +15536,7 @@ [(set_attr "type" "call")]) (define_insn "*sibcall_1" - [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,c,d,a")) + [(call (mem:QI (match_operand:SI 0 "sibcall_insn_operand" "s,!c,!d,a")) (match_operand 1 "" ""))] "SIBLING_CALL_P (insn) && !TARGET_64BIT" { @@ -22183,7 +22183,7 @@ (define_insn "*sibcall_value_1" [(set (match_operand 0 "" "") - (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,c,d,a")) + (call (mem:QI (match_operand:SI 1 "sibcall_insn_operand" "s,!c,!d,a")) (match_operand:SI 2 "" "")))] "SIBLING_CALL_P (insn) && !TARGET_64BIT" { -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38900