public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59553] New: emit_library_call_value_1 generates usage of virtual_outgoint_args_rtx when virtuals_instantiated is 1
@ 2013-12-19  0:45 makhaloff at gmail dot com
  2022-01-10 10:12 ` [Bug middle-end/59553] emit_library_call_value_1 generates usage of virtual_outgoing_args_rtx " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: makhaloff at gmail dot com @ 2013-12-19  0:45 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/59553] emit_library_call_value_1 generates usage of virtual_outgoing_args_rtx when virtuals_instantiated is 1
  2013-12-19  0:45 [Bug middle-end/59553] New: emit_library_call_value_1 generates usage of virtual_outgoint_args_rtx when virtuals_instantiated is 1 makhaloff at gmail dot com
@ 2022-01-10 10:12 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-10 10:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59553

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
An almost exact dup of bug 52773 which was fixed in GCC 5 by r5-6559. The fix
uses stack_pointer_rtx always instead of virtual_outgoing_args_rtx.

*** This bug has been marked as a duplicate of bug 52773 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-10 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-19  0:45 [Bug middle-end/59553] New: emit_library_call_value_1 generates usage of virtual_outgoint_args_rtx when virtuals_instantiated is 1 makhaloff at gmail dot com
2022-01-10 10:12 ` [Bug middle-end/59553] emit_library_call_value_1 generates usage of virtual_outgoing_args_rtx " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).