http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59553
Bug ID: 59553 Summary: emit_library_call_value_1 generates usage of virtual_outgoint_args_rtx when virtuals_instantiated is 1 Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: makhaloff at gmail dot com Created attachment 31476 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31476&action=edit patch to fix that problem I'm porting gcc on some target. I have following macroses: #define ACCUMULATE_OUTGOING_ARGS 0 #define PUSH_ARGS 1 #define PUSH_ARGS_REVERSED 0 As you can see it's rarely case. I got following ICE: webizer.c: In function 'configure2': webizer.c:30:1: internal compiler error: in replace_pseudos_in, at reload1.c:576 } ^ 0x8386eea replace_pseudos_in ../../gcc-4.8.2/gcc/reload1.c:575 0x8386eae replace_pseudos_in ../../gcc-4.8.2/gcc/reload1.c:592 0x8386eae replace_pseudos_in ../../gcc-4.8.2/gcc/reload1.c:592 0x8386eae replace_pseudos_in ../../gcc-4.8.2/gcc/reload1.c:592 0x839160f reload(rtx_def*, int) ../../gcc-4.8.2/gcc/reload1.c:1185 0x82cb8eb do_reload ../../gcc-4.8.2/gcc/ira.c:4679 0x82cb8eb rest_of_handle_reload ../../gcc-4.8.2/gcc/ira.c:4779 replace_pseudos_in was trying to replace virtual-outgoing-args in that instruction: (call_insn/u 121 601 124 4 (parallel [ (set (reg:SI 0 r0) (call (mem:SI (symbol_ref:SI ("__lshrsi3") [flags 0x41]) [0 S4 A32]) (const_int 8 [0x8]))) ]) 38 {call_value_insn_sym} (expr_list:REG_EH_REGION (const_int -2147483648 [0x80000000]) (nil)) (expr_list:REG_DEP_TRUE (use (mem:SI (plus:SI (reg/f:SI 16 virtual-outgoing-args) (scratch:SI)) [0 S4 A32])) (expr_list:REG_DEP_TRUE (use (mem:SI (plus:SI (reg/f:SI 16 virtual-outgoing-args) (scratch:SI)) [0 S4 A32])) (nil)))) I found a place where gcc emits this call and expr list: calls.c:4053 (emit_library_call_value_1) At that moment virtuals_instantiated was equal 1. So that is an error, because forbidden to use virtual regs when virtuals_instantiated is nonzero. I decide to make changes similar to calls.c:3915 (to use SP + OFFSET) It works for me. --- calls.c 2013-12-19 00:16:59.857462118 -0800 +++ calls.c 2013-12-19 00:39:03.780723916 -0800 @@ -4050,8 +4050,14 @@ auto-increment causes confusion. So we merely indicate that we access something with a known mode somewhere on the stack. */ - use = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx, - gen_rtx_SCRATCH (Pmode)); + if (virtuals_instantiated) + use = gen_rtx_PLUS (Pmode, + plus_constant (Pmode, stack_pointer_rtx, + STACK_POINTER_OFFSET), + gen_rtx_SCRATCH (Pmode)); + else + use = gen_rtx_PLUS (Pmode, virtual_outgoing_args_rtx, + gen_rtx_SCRATCH (Pmode)); use = gen_rtx_MEM (argvec[argnum].mode, use); use = gen_rtx_USE (VOIDmode, use); call_fusage = gen_rtx_EXPR_LIST (VOIDmode, use, call_fusage); Thanks. Alexey