public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/25572]  New: ppc64 -mminimal-toc trashes r30
@ 2005-12-27  0:16 anton at samba dot org
  2005-12-27  0:18 ` [Bug target/25572] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: anton at samba dot org @ 2005-12-27  0:16 UTC (permalink / raw)
  To: gcc-bugs

We found this problem when building a ppc64 Linux kernel. It turns out r30 was
not preserved in a function that was using a local TOC. The compiler used was:

gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)

Although it seems to reproduce on older toolchains too (eg 3.4).

pinskia cut the original test case down to:

/* Compile with -m64 -O2 -mminimal-toc */
int per_cpu__kstat;

int *f()
{
  int *__ptr;
  asm volatile(";%0":"=g"(__ptr):"0"(&per_cpu__kstat));
  return __ptr;
}

/*
.f:
        ld 30,.LCTOC0@toc(2)
        ld 9,.LC0-.LCTOC1(30)
        mr 3,9
#APP
        ;3
#NO_APP

*/


-- 
           Summary: ppc64 -mminimal-toc trashes r30
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
GCC target triplet: powerpc64-unknown-linux-gnu


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
@ 2005-12-27  0:18 ` pinskia at gcc dot gnu dot org
  2005-12-28  3:03 ` amodra at bigpond dot net dot au
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-27  0:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-27 00:18 -------
Confirmed, not a regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |target
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 4.0.0 3.4.0 4.1.0
                   |                            |4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-27 00:18:30
               date|                            |


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
  2005-12-27  0:18 ` [Bug target/25572] " pinskia at gcc dot gnu dot org
@ 2005-12-28  3:03 ` amodra at bigpond dot net dot au
  2005-12-28  4:53 ` amodra at bigpond dot net dot au
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at bigpond dot net dot au @ 2005-12-28  3:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amodra at bigpond dot net dot au  2005-12-28 03:03 -------
Happens at -O0 too.  At -O0, r30 is used for the first time when reload decides
that the asm_operands in the following needs reloading.  regs_ever_live[30]
isn't set.

(insn 8 6 10 3 (set (mem/c/i:DI (plus:DI (reg/f:DI 113 sfp)
                (const_int 48 [0x30])) [0 __ptr+0 S8 A128])
        (asm_operands/v:DI (";%0") ("=g") 0 [
                (symbol_ref:DI ("per_cpu__kstat") <var_decl 0x80003499a0
per_cpu__kstat>)
            ]
             [
                (asm_input:DI ("0"))
            ] ("/src/tmp/pr25572.c") 7)) -1 (nil)
    (nil))


-- 


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
  2005-12-27  0:18 ` [Bug target/25572] " pinskia at gcc dot gnu dot org
  2005-12-28  3:03 ` amodra at bigpond dot net dot au
@ 2005-12-28  4:53 ` amodra at bigpond dot net dot au
  2005-12-28  5:18 ` amodra at bigpond dot net dot au
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at bigpond dot net dot au @ 2005-12-28  4:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from amodra at bigpond dot net dot au  2005-12-28 04:52 -------
Adding
  if (no_new_pseudos)
    regs_ever_live[TOC_REGISTER] = 1;
to rs6000.c:create_TOC_reference fixes this problem.  There seems to be
precedent for such chicanery: eg. rs6000_got_register and a number of places in
i386.c setting regs_ever_live[PIC_OFFSET_TABLE_REGNUM].


-- 

amodra at bigpond dot net dot au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu dot org


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (2 preceding siblings ...)
  2005-12-28  4:53 ` amodra at bigpond dot net dot au
@ 2005-12-28  5:18 ` amodra at bigpond dot net dot au
  2005-12-29  1:10 ` amodra at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at bigpond dot net dot au @ 2005-12-28  5:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

amodra at bigpond dot net dot au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |amodra at bigpond dot net
                   |dot org                     |dot au
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-12-27 00:18:30         |2005-12-28 05:18:48
               date|                            |


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (3 preceding siblings ...)
  2005-12-28  5:18 ` amodra at bigpond dot net dot au
@ 2005-12-29  1:10 ` amodra at gcc dot gnu dot org
  2005-12-29  1:14 ` amodra at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gcc dot gnu dot org @ 2005-12-29  1:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from amodra at gcc dot gnu dot org  2005-12-29 01:10 -------
Subject: Bug 25572

Author: amodra
Date: Thu Dec 29 01:10:05 2005
New Revision: 109133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109133
Log:
        PR target/25572
        * config/rs6000/rs6000.c (create_TOC_reference): Set regs_ever_live.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c


-- 


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (4 preceding siblings ...)
  2005-12-29  1:10 ` amodra at gcc dot gnu dot org
@ 2005-12-29  1:14 ` amodra at gcc dot gnu dot org
  2005-12-29  1:20 ` amodra at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gcc dot gnu dot org @ 2005-12-29  1:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from amodra at gcc dot gnu dot org  2005-12-29 01:14 -------
Subject: Bug 25572

Author: amodra
Date: Thu Dec 29 01:14:18 2005
New Revision: 109134

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109134
Log:
        PR target/25572
        * config/rs6000/rs6000.c (create_TOC_reference): Set regs_ever_live.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/config/rs6000/rs6000.c


-- 


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (5 preceding siblings ...)
  2005-12-29  1:14 ` amodra at gcc dot gnu dot org
@ 2005-12-29  1:20 ` amodra at gcc dot gnu dot org
  2005-12-29  1:29 ` amodra at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gcc dot gnu dot org @ 2005-12-29  1:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from amodra at gcc dot gnu dot org  2005-12-29 01:20 -------
Subject: Bug 25572

Author: amodra
Date: Thu Dec 29 01:20:15 2005
New Revision: 109135

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109135
Log:
        PR target/25572
        * config/rs6000/rs6000.c (create_TOC_reference): Set regs_ever_live.


Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/config/rs6000/rs6000.c


-- 


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (6 preceding siblings ...)
  2005-12-29  1:20 ` amodra at gcc dot gnu dot org
@ 2005-12-29  1:29 ` amodra at gcc dot gnu dot org
  2005-12-29  1:29 ` amodra at bigpond dot net dot au
  2006-01-01  5:35 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gcc dot gnu dot org @ 2005-12-29  1:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from amodra at gcc dot gnu dot org  2005-12-29 01:29 -------
Subject: Bug 25572

Author: amodra
Date: Thu Dec 29 01:29:18 2005
New Revision: 109136

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109136
Log:
        PR target/25572
        * config/rs6000/rs6000.c (create_TOC_reference): Set regs_ever_live.


Modified:
    branches/gcc-3_4-branch/gcc/ChangeLog
    branches/gcc-3_4-branch/gcc/config/rs6000/rs6000.c


-- 


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (7 preceding siblings ...)
  2005-12-29  1:29 ` amodra at gcc dot gnu dot org
@ 2005-12-29  1:29 ` amodra at bigpond dot net dot au
  2006-01-01  5:35 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at bigpond dot net dot au @ 2005-12-29  1:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from amodra at bigpond dot net dot au  2005-12-29 01:29 -------
Fixed


-- 

amodra at bigpond dot net dot au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug target/25572] ppc64 -mminimal-toc trashes r30
  2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
                   ` (8 preceding siblings ...)
  2005-12-29  1:29 ` amodra at bigpond dot net dot au
@ 2006-01-01  5:35 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-01  5:35 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.3.3 4.0.0 3.4.0 4.1.0     |3.3.3 4.0.0 3.4.0
                   |4.2.0                       |
      Known to work|                            |4.0.3 3.4.6 4.1.0 4.2.0
   Target Milestone|---                         |3.4.6


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



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

end of thread, other threads:[~2006-01-01  5:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-27  0:16 [Bug c/25572] New: ppc64 -mminimal-toc trashes r30 anton at samba dot org
2005-12-27  0:18 ` [Bug target/25572] " pinskia at gcc dot gnu dot org
2005-12-28  3:03 ` amodra at bigpond dot net dot au
2005-12-28  4:53 ` amodra at bigpond dot net dot au
2005-12-28  5:18 ` amodra at bigpond dot net dot au
2005-12-29  1:10 ` amodra at gcc dot gnu dot org
2005-12-29  1:14 ` amodra at gcc dot gnu dot org
2005-12-29  1:20 ` amodra at gcc dot gnu dot org
2005-12-29  1:29 ` amodra at gcc dot gnu dot org
2005-12-29  1:29 ` amodra at bigpond dot net dot au
2006-01-01  5:35 ` pinskia at gcc dot gnu dot 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).