[Bug target/36634] -msecure-plt combine gives invalid call insn

amodra at bigpond dot net dot au gcc-bugzilla@gcc.gnu.org
Fri Jun 27 01:52:00 GMT 2008



------- Comment #1 from amodra at bigpond dot net dot au  2008-06-27 01:52 -------
(insn 9 8 11 1 (set (reg/v/f:SI 119 [ p ])
        (mem/u/c:SI (plus:SI (reg:SI 30 30)
                (const:SI (minus:SI (symbol_ref/u:SI ("*.LC2") [flags 0x2])
                        (symbol_ref:SI ("*.LCTOC1"))))) [5 S4 A8])) -1 (nil)
    (expr_list:REG_EQUAL (symbol_ref:SI ("myprint") [flags 0x1] <function_decl
0x40164300 myprint>)
        (nil)))

[snip]

(call_insn 12 11 13 1 (parallel [
            (call (mem:SI (reg/v/f:SI 119 [ p ]) [0 S4 A8])
                (const_int 0 [0x0]))
            (use (const_int 0 [0x0]))
            (clobber (scratch:SI))
        ]) -1 (nil)
    (nil)
    (expr_list:REG_DEP_TRUE (use (reg:SI 3 3))
        (nil)))

The first instruction is a GOT load of the function address, the second an
indirect call.  No problem there.  Indirect calls for -msecure-plt don't need
the GOT pointer to be valid.

The trouble occurrs when combine substitutes the first insn into the second to
get:

(call_insn 12 11 13 0 (parallel [
            (call (mem:SI (symbol_ref:SI ("myprint") [flags 0x1] <function_decl
0x40164300 myprint>) [0 S4 A8])
                (const_int 0 [0x0]))
            (use (const_int 0 [0x0]))
            (clobber (scratch:SI))
        ]) 402 {*call_nonlocal_sysv} (insn_list:REG_DEP_TRUE 11 (nil))
    (expr_list:REG_UNUSED (scratch:SI)
        (expr_list:REG_DEAD (reg:SI 3 3)
            (nil)))
    (expr_list:REG_DEP_TRUE (use (reg:SI 3 3))
        (nil)))

Note that lack of anything marking r30 as used.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36634



More information about the Gcc-bugs mailing list