This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/71709] powerpc64le: argument to strcpy() optimised out


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

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |amodra at gmail dot com
           Assignee|unassigned at gcc dot gnu.org      |amodra at gmail dot com

--- Comment #4 from Alan Modra <amodra at gmail dot com> ---
Comment #3 isn't showing any real problem.  Where things go wrong is in ira
where the first strcpy call gets a bad REG_RETURNED note.

I think it is a bug in ira-lives.c:find_call_crossed_cheap_reg where insn 50
below is not recognized as a single_set due to the unspec in the parallel
(which is an rs6000 backend problem that needs fixing too), then tries to use
reg_overlap_mentioned_p but that misses the set dest.  So
find_call_crossed_cheap_reg thinks r3 hasn't been touched at that point and
looks back at prior insns, finding the set from reg 168.


(insn 50 42 44 2 (parallel [
            (set (reg:DI 3 3)
                (mem/f/c:DI (unspec:DI [
                            (plus:DI (unspec:DI [
                                        (symbol_ref:DI ("*.LANCHOR0") [flags
0x182])
                                        (reg:DI 2 2)
                                    ] UNSPEC_TOCREL)
                                (const_int 2048 [0x800]))
                        ] UNSPEC_FUSION_ADDIS) [1 saved_command_line+0 S8
A64]))
            (unspec [
                    (const_int 0 [0])
                ] UNSPEC_FUSION_ADDIS)
            (use (reg:DI 2 2))
            (clobber (scratch:DI))
        ]) /home/alan/anton.c:18 875 {*toc_fusionload_di}
     (nil))

(call_insn 44 50 45 2 (parallel [
            (set (reg:DI 3 3)
                (call (mem:SI (symbol_ref:DI ("strcpy") [flags 0x41] 
<function_decl 0x7f5bb162be00 strcpy>) [0 __builtin_strcpy S4 A8])
                    (const_int 0 [0])))
            (clobber (reg:DI 65 lr))
        ]) /home/alan/anton.c:18 711 {*call_value_nonlocal_aixdi}
     (expr_list:REG_RETURNED (reg/f:DI 168 [ _15 ])
        (expr_list:REG_DEAD (reg:DI 4 4)
            (expr_list:REG_UNUSED (reg:DI 3 3)
                (expr_list:REG_CALL_DECL (symbol_ref:DI ("strcpy") [flags 0x41]
 <function_decl 0x7f5bb162be00 strcpy>)
                    (expr_list:REG_EH_REGION (const_int 0 [0])
                        (nil))))))
    (expr_list (use (reg:DI 2 2))
        (expr_list:DI (set (reg:DI 3 3)
                (reg:DI 3 3))
            (expr_list:DI (use (reg:DI 3 3))
                (expr_list:DI (use (reg:DI 4 4))
                    (nil))))))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]