public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49521] New: [arm] Bad PIC register load in for static initializers
@ 2011-06-24 13:37 rmansfield at qnx dot com
  2011-06-24 13:48 ` [Bug target/49521] " ramana at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2011-06-24 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [arm] Bad PIC register load in for static initializers
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rmansfield@qnx.com
              Host: x86_64-linux-gnu
            Target: arm-unknown-linux-gnu
             Build: x86_64-linux-gnu


$ ./xgcc -v
../configure --target=arm-unknown-linux-gnu
--prefix=/home/ryan/x-tools/arm-unknown-linux-gnu
--with-headers=/home/ryan/x-tools/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include
--with-local-prefix=/home/ryan/x-tools/arm-unknown-linux-gnu/arm-unknown-linux-gnu
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.6.1 20110518 (prerelease) [gcc-4_6-branch revision 173875] (GCC) 


Yes, this only happens with the old ABI but this wrong-code seems to happens
very frequently. 

$ ./xgcc -B. -fpic -O2 ~/t.ii -S

_GLOBAL__sub_I_t.ii:
        @ args = 0, pretend = 0, frame = 116
        @ frame_needed = 1, uses_anonymous_args = 0
        stmfd   sp!, {fp, lr}
        ldr     r1, .L1064  <- load GOT offset
        add     fp, sp, #4
        sub     sp, sp, #116
        mov     r0, #0 
        ldr     r1, [r0, r1] <- crash

<snip>

.L1064:
        .word   __gxx_personality_sj0(GOT)


(note 2 354 264 NOTE_INSN_FUNCTION_BEG)

(insn 264 2 287 (set (reg:SI 2 r2)
        (const_int 0 [0])) 168 {*arm_movsi_insn}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))

(insn 287 264 288 (set (reg:SI 3 r3 [275])
        (unspec:SI [
                (mem:SI (label_ref 364) [0 S4 A32])
            ] 3)) 170 {pic_load_addr_32bit}
     (expr_list:REG_EQUIV (unspec:SI [
                (symbol_ref:SI ("__gxx_personality_sj0") [flags 0x41])
            ] 3)
        (nil)))

(insn 288 287 229 (set (reg/f:SI 3 r3 [256])
        (mem:SI (plus:SI (reg:SI 2 r2)
                (reg:SI 3 r3 [275])) [0 S4 A32])) 168 {*arm_movsi_insn}
     (expr_list:REG_DEAD (reg:SI 2 r2)
        (expr_list:REG_EQUIV (symbol_ref:SI ("__gxx_personality_sj0") [flags
0x41])
            (nil))))

(insn 229 288 230 (set (mem/c:SI (plus:SI (reg/f:SI 11 fp)
                (const_int -32 [0xffffffffffffffe0])) [0 S4 A32])
        (reg/f:SI 3 r3 [256])) 168 {*arm_movsi_insn}
     (expr_list:REG_DEAD (reg/f:SI 3 r3 [256])
        (nil)))

If I explicitly specify a PIC register (e.g. -mpic-register=4), the load is
sane.

e.g.

_GLOBAL__sub_I_t.ii:
        @ args = 0, pretend = 0, frame = 112
        @ frame_needed = 1, uses_anonymous_args = 0
        stmfd   sp!, {r4, fp, lr}
        ldr     r4, .L1064
        add     fp, sp, #8
        ldr     r2, .L1064+4
        sub     sp, sp, #112
        ldr     r1, .L1064+8
        ldr     r0, .L1064+12
.LPIC227:
        add     r4, pc, r4
        ldr     r3, .L1064+16
        ldr     r1, [r4, r1]

<snip>
.L1064:
        .word   _GLOBAL_OFFSET_TABLE_-(.LPIC227+8)
        .word   .LLSDA1449-(.LPIC224+8)
        .word   __gxx_personality_sj0(GOT)


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

* [Bug target/49521] [arm] Bad PIC register load in for static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
@ 2011-06-24 13:48 ` ramana at gcc dot gnu.org
  2011-06-24 13:49 ` ramana at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-06-24 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org

--- Comment #1 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-06-24 13:47:42 UTC ---
Missing a testcase for someone to take a look.  

Ramana


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

* [Bug target/49521] [arm] Bad PIC register load in for static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
  2011-06-24 13:48 ` [Bug target/49521] " ramana at gcc dot gnu.org
@ 2011-06-24 13:49 ` ramana at gcc dot gnu.org
  2011-06-24 13:51 ` rmansfield at qnx dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-06-24 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.06.24 13:48:02
     Ever Confirmed|0                           |1


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

* [Bug target/49521] [arm] Bad PIC register load in for static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
  2011-06-24 13:48 ` [Bug target/49521] " ramana at gcc dot gnu.org
  2011-06-24 13:49 ` ramana at gcc dot gnu.org
@ 2011-06-24 13:51 ` rmansfield at qnx dot com
  2011-06-24 13:57 ` ramana at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2011-06-24 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Ryan Mansfield <rmansfield at qnx dot com> 2011-06-24 13:50:48 UTC ---
Created attachment 24591
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24591
preprocessed source


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

* [Bug target/49521] [arm] Bad PIC register load in for static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
                   ` (2 preceding siblings ...)
  2011-06-24 13:51 ` rmansfield at qnx dot com
@ 2011-06-24 13:57 ` ramana at gcc dot gnu.org
  2011-06-24 14:27 ` [Bug target/49521] [arm] Bad PIC register load in " rmansfield at qnx dot com
  2013-12-17 16:47 ` rmansfield at qnx dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-06-24 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW


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

* [Bug target/49521] [arm] Bad PIC register load in static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
                   ` (3 preceding siblings ...)
  2011-06-24 13:57 ` ramana at gcc dot gnu.org
@ 2011-06-24 14:27 ` rmansfield at qnx dot com
  2013-12-17 16:47 ` rmansfield at qnx dot com
  5 siblings, 0 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2011-06-24 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

Ryan Mansfield <rmansfield at qnx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
            Summary|[arm] Bad PIC register load |[arm] Bad PIC register load
                   |in for static initializers  |in static initializers

--- Comment #3 from Ryan Mansfield <rmansfield at qnx dot com> 2011-06-24 14:26:49 UTC ---
Add keyword.


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

* [Bug target/49521] [arm] Bad PIC register load in static initializers
  2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
                   ` (4 preceding siblings ...)
  2011-06-24 14:27 ` [Bug target/49521] [arm] Bad PIC register load in " rmansfield at qnx dot com
@ 2013-12-17 16:47 ` rmansfield at qnx dot com
  5 siblings, 0 replies; 7+ messages in thread
From: rmansfield at qnx dot com @ 2013-12-17 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

Ryan Mansfield <rmansfield at qnx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Ryan Mansfield <rmansfield at qnx dot com> ---
ARM OABI is no longer a supported target


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

end of thread, other threads:[~2013-12-17 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-24 13:37 [Bug target/49521] New: [arm] Bad PIC register load in for static initializers rmansfield at qnx dot com
2011-06-24 13:48 ` [Bug target/49521] " ramana at gcc dot gnu.org
2011-06-24 13:49 ` ramana at gcc dot gnu.org
2011-06-24 13:51 ` rmansfield at qnx dot com
2011-06-24 13:57 ` ramana at gcc dot gnu.org
2011-06-24 14:27 ` [Bug target/49521] [arm] Bad PIC register load in " rmansfield at qnx dot com
2013-12-17 16:47 ` rmansfield at qnx dot com

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).