From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15717 invoked by alias); 19 Dec 2013 00:45:38 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 15690 invoked by uid 48); 19 Dec 2013 00:45:33 -0000 From: "makhaloff at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/59553] New: emit_library_call_value_1 generates usage of virtual_outgoint_args_rtx when virtuals_instantiated is 1 Date: Thu, 19 Dec 2013 00:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: makhaloff at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg01706.txt.bz2 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