public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/21518] [4.0/4.1 Regression] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
@ 2005-10-07 21:55 ` steven at gcc dot gnu dot org
  2005-10-07 21:58 ` steven at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-07 21:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from steven at gcc dot gnu dot org  2005-10-07 21:55 -------
I guess something like this should work if Andrew was right in comment #6.

Obviously this doesn't fix the the test case from comment #1 because we
don't go through this code if a user codes an "attribute regparm".

Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.862
diff -u -3 -p -r1.862 i386.c
--- config/i386/i386.c  5 Oct 2005 18:19:25 -0000       1.862
+++ config/i386/i386.c  7 Oct 2005 21:41:41 -0000
@@ -2171,10 +2171,13 @@ ix86_function_regparm (tree type, tree d
                if (global_regs[local_regparm])
                  break;
              /* We can't use regparm(3) for nested functions as these use
-                static chain pointer in third argument.  */
+                static chain pointer in third argument.  We also can't use
+                it when we are producing PIC code because one register is
+                reserved for the GOT (see e.g. PR21518).  */
              if (local_regparm == 3
-                 && decl_function_context (decl)
-                 && !DECL_NO_STATIC_CHAIN (decl))
+                 && ((decl_function_context (decl)
+                      && !DECL_NO_STATIC_CHAIN (decl))
+                     || flag_pic))
                local_regparm = 2;
              /* Each global register variable increases register preassure,
                 so the more global reg vars there are, the smaller regparm


-- 


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
  2005-10-07 21:55 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 steven at gcc dot gnu dot org
@ 2005-10-07 21:58 ` steven at gcc dot gnu dot org
  2005-10-31  3:35 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-10-07 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from steven at gcc dot gnu dot org  2005-10-07 21:58 -------
I have no time to work on this.  Note that there is no test case anymore
either, so it's hard to tell whether a fix is doing the right thing.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|steven at gcc dot gnu dot   |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
  2005-10-07 21:55 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 steven at gcc dot gnu dot org
  2005-10-07 21:58 ` steven at gcc dot gnu dot org
@ 2005-10-31  3:35 ` mmitchel at gcc dot gnu dot org
  2005-11-01  7:25 ` rth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  3:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from mmitchel at gcc dot gnu dot org  2005-10-31 03:35 -------
It sounds like we should (a) forbid __attribute__((regparm(3)) with -fPIC, and
(b) not automatically generate that value, as per the patch in Comment #9.  It
doesn't seem useful to have an option that we think is too dangerous to use.

I'm going to leave this as P2, because, if that's correct, this seems
relatively easy to fix, and it would avoid one class of user confusion.


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-10-31  3:35 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function mmitchel at gcc dot gnu dot org
@ 2005-11-01  7:25 ` rth at gcc dot gnu dot org
  2005-11-01  7:35 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-11-01  7:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-07-26 23:34:10         |2005-11-01 07:25:38
               date|                            |


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-11-01  7:25 ` rth at gcc dot gnu dot org
@ 2005-11-01  7:35 ` rth at gcc dot gnu dot org
  2005-11-02  2:12 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-11-01  7:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from rth at gcc dot gnu dot org  2005-11-01 07:35 -------
Frankly, this smells like a plain old-fashioned reload bug to me.
There's no reason this insn couldn't have been rendered as

  movl %esi,%eax
  movbl %al,%eax

Investigating further to see how nasty it might be...


-- 


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2005-11-01  7:35 ` rth at gcc dot gnu dot org
@ 2005-11-02  2:12 ` rth at gcc dot gnu dot org
  2005-11-02  6:31 ` rth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-11-02  2:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from rth at gcc dot gnu dot org  2005-11-02 02:12 -------
Subject: Bug 21518

Author: rth
Date: Wed Nov  2 02:12:32 2005
New Revision: 106373

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106373
Log:
        PR 21518
        * loop.c (scan_loop): Do not propagate computations to a hard
        register destination with SMALL_REGISTER_CLASSES.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr21518.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/loop.c


-- 


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2005-11-02  2:12 ` rth at gcc dot gnu dot org
@ 2005-11-02  6:31 ` rth at gcc dot gnu dot org
  2005-11-02  6:32 ` rth at gcc dot gnu dot org
  2008-09-25 23:25 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-11-02  6:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from rth at gcc dot gnu dot org  2005-11-02 06:31 -------
Subject: Bug 21518

Author: rth
Date: Wed Nov  2 06:31:48 2005
New Revision: 106378

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106378
Log:
        PR 21518
        * loop.c (scan_loop): Do not propagate computations to a hard
        register destination with SMALL_REGISTER_CLASSES.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/gcc.target/i386/pr21518.c
      - copied unchanged from r106374,
trunk/gcc/testsuite/gcc.target/i386/pr21518.c
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/loop.c


-- 


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2005-11-02  6:31 ` rth at gcc dot gnu dot org
@ 2005-11-02  6:32 ` rth at gcc dot gnu dot org
  2008-09-25 23:25 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 9+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-11-02  6:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from rth at gcc dot gnu dot org  2005-11-02 06:32 -------
Fixed.


-- 

rth at gcc dot gnu dot org changed:

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


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


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

* [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function
       [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2005-11-02  6:32 ` rth at gcc dot gnu dot org
@ 2008-09-25 23:25 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-09-25 23:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from pinskia at gcc dot gnu dot org  2008-09-25 23:24 -------
I just ran into this again while working on a patch for fwprop.c and I noticed
that SMALL_REGISTER_CLASSES is true even for x86_64 which seems wrong.


-- 


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


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

end of thread, other threads:[~2008-09-25 23:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21518-10616@http.gcc.gnu.org/bugzilla/>
2005-10-07 21:55 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 steven at gcc dot gnu dot org
2005-10-07 21:58 ` steven at gcc dot gnu dot org
2005-10-31  3:35 ` [Bug target/21518] [4.0/4.1 Regression] unable to find a register with -fPIC and -O2 and non inlining static function mmitchel at gcc dot gnu dot org
2005-11-01  7:25 ` rth at gcc dot gnu dot org
2005-11-01  7:35 ` rth at gcc dot gnu dot org
2005-11-02  2:12 ` rth at gcc dot gnu dot org
2005-11-02  6:31 ` rth at gcc dot gnu dot org
2005-11-02  6:32 ` rth at gcc dot gnu dot org
2008-09-25 23:25 ` 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).