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

            Bug ID: 63620
           Summary: RELOAD lost SET_GOT dependency on Darwin
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: evstupac at gmail dot com
                CC: law at redhat dot com, vmakarov at redhat dot com
            Target: Darwin

Created attachment 33782
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33782&action=edit
reproducer

For the attached tests even with fix in pr63618 SET_GOT is deleted on Darwin.

For some reason there are no dependency between:

(RELOAD PASS)

(insn/f 43 6 2 2 (parallel [ 
            (set (reg:SI 0 ax [87])
                (unspec:SI [
                        (const_int 0 [0]) 
                    ] UNSPEC_SET_GOT)) 
            (clobber (reg:CC 17 flags)) 
        ]) 679 {set_got} 
     (expr_list:REG_EQUIV (unspec:SI [ 
                (const_int 0 [0]) 
            ] UNSPEC_SET_GOT) 
        (expr_list:REG_CFA_FLUSH_QUEUE (nil)
            (nil)))) 

and

(insn 46 17 47 3 (set (reg:SI 0 ax [93]) 
        (plus:SI (reg:SI 0 ax [87]) 
            (const:SI (unspec:SI [ 
                        (symbol_ref/u:SI ("*LC0") [flags 0x2]) 
                    ] UNSPEC_MACHOPIC_OFFSET)))) elim_setgot_darwin.c:20 213
{*leasi}
     (expr_list:REG_EQUAL (symbol_ref/u:SI ("*LC0") [flags 0x2])
        (nil))) 

And at 231r.ce3 SET_GOT is deleted which lead to incorrect code.

The issue reproduced on Darwin only, however it can be reproduced at cross
build configured as:
../configure --target=x86_64-apple-darwin11 --prefix=...
--enable-languages=c,c++ --enable-bootstrap=no

To reproduce we need only cc1:

gcc/cc1 elim_setgot_darwin.c -m32 -fPIE -O2 -msse4.2 -mtune=corei7 -fno-inline
-fdump-rtl-all

Reply via email to