public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
@ 2005-05-11 19:54 couriousous at mandriva dot org
  2005-05-11 19:57 ` [Bug target/21518] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: couriousous at mandriva dot org @ 2005-05-11 19:54 UTC (permalink / raw)
  To: gcc-bugs

GCC version:     
gcc (GCC) 4.0.0 (4.0.0-3mdk for Mandriva Linux release 2006.0)     
But also tested with gcc 4.1 CVS 0508     
     
Architecture: ix86     
     
GCC cannot compile the following code when -O2 and -fPIC are used :     
     
     
     
static void drawPointsLines (char type, int first, int *dd) {*dd += 1;}       
       
int do_locator (int *call)       
{       
  int *dd = call;       
  int i = 0, type = 1;       
  if (call == 0)       
      for (; i < 2; i++)       
              dd += type;       
  else       
    {       
      type = *call;       
      for(; i < 2; i++)       
          if (type != i)       
              drawPointsLines (type,0, call);       
    }       
  drawPointsLines(type,0,call);       
  return 0;       
}     
     
     
[couriousous@localhost ~]$ gcc -c -O2 -fPIC gccbug.c    
gccbug.c: In function 'do_locator':    
gccbug.c:19: error: unable to find a register to spill in class 'Q_REGS'    
gccbug.c:19: error: this is the insn:    
(insn:HI 44 43 45 6 (set (reg:SI 0 ax [ type ])    
        (sign_extend:SI (subreg:QI (reg/v:SI 4 si [orig:63 type ] [63]) 0))) 84    
{extendqisi2} (nil)    
    (nil))    
gccbug.c:19: confused by earlier errors, bailing out    
    
But it compile if I remove -fPIC or -O2     
   
BTW, with gcc 3.4.1 cvs 0508 I get the following message in addition to the 
error ( translated from french ):  
Internal compiler error: in spill_failure at reload1.c:1897  
  
This is a regression from gcc 3.4.3   
  
There is maybe more updated information on the Mandriva bugreport:  
http://qa.mandriva.com/show_bug.cgi?id=15840

-- 
           Summary: error: unable to find a register to spill in class
                    'Q_REGS' with -fPIC and -O2
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: couriousous at mandriva dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug target/21518] error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
@ 2005-05-11 19:57 ` pinskia at gcc dot gnu dot org
  2005-05-11 21:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 19:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
 GCC target triplet|                            |i686-pc-linux-gnu


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


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

* [Bug target/21518] [4.0/4.1 Regression] error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
  2005-05-11 19:57 ` [Bug target/21518] " pinskia at gcc dot gnu dot org
@ 2005-05-11 21:00 ` pinskia at gcc dot gnu dot org
  2005-05-11 21:23 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 21:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.0.0 4.1.0
      Known to work|                            |3.4.0
            Summary|error: unable to find a     |[4.0/4.1 Regression] error:
                   |register to spill in class  |unable to find a register to
                   |'Q_REGS' with -fPIC and -O2 |spill in class 'Q_REGS' with
                   |                            |-fPIC and -O2
   Target Milestone|---                         |4.0.1


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


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

* [Bug target/21518] [4.0/4.1 Regression] error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
  2005-05-11 19:57 ` [Bug target/21518] " pinskia at gcc dot gnu dot org
  2005-05-11 21:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-11 21:23 ` pinskia at gcc dot gnu dot org
  2005-05-11 21:24 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 21:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 21:23 -------
Confirmed, here is a testcase for before 4.0.0, if you use this testcase after 4.0.0, use -fno-tree-pre 
but that is because we missing a PRE opportunity right now (PR 21520) and if that gets fixed, the 
orginal testcase will not ICE any more:
static void __attribute__((regparm(3)))
drawPointsLines (char type, int first, int *dd) {*dd += 1;}

int do_locator (int *call)
{
  char prephitmp5;
  int type;
  int i;

  if (call == 0) {prephitmp5 = 1;}
  else
  {

  type = *call;
  i = 0;

do {
  if (i != type)
    drawPointsLines ((int) (char) type, 0, call);
  i = i + 1;
  } while (i != 2);
  
  prephitmp5 = (char) type;
}
  drawPointsLines ((int) prephitmp5, 0, call);
  return 0;
}


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to work|3.4.0                       |
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-11 21:23:09
               date|                            |


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


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

* [Bug target/21518] [4.0/4.1 Regression] error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (2 preceding siblings ...)
  2005-05-11 21:23 ` pinskia at gcc dot gnu dot org
@ 2005-05-11 21:24 ` pinskia at gcc dot gnu dot org
  2005-05-12  8:59 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 21:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 21:24 -------
Note my testcase fails in 2.95.3, 3.0.4, 3.2.3, 3.3.3, and 3.4.0.

-- 


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


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

* [Bug target/21518] [4.0/4.1 Regression] error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (3 preceding siblings ...)
  2005-05-11 21:24 ` pinskia at gcc dot gnu dot org
@ 2005-05-12  8:59 ` jakub at gcc dot gnu dot org
  2005-05-12 10:59 ` [Bug target/21518] " steven at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-05-12  8:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-05-12 08:59 -------
Using regparm(3) with -fPIC is a really bad idea.  i386 has 4 Q_REGS class
registers, 3 of them are used for regparm(3) (%eax, %edx, %ecx) and the last
one for PIC pointer (%ebx), so reload really has hard time to satisfy this.

-- 


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


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

* [Bug target/21518] unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (4 preceding siblings ...)
  2005-05-12  8:59 ` jakub at gcc dot gnu dot org
@ 2005-05-12 10:59 ` steven at gcc dot gnu dot org
  2005-05-12 12:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-05-12 10:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-05-12 10:59 -------
Andrew's test case shows that it is easy to make this fail with other 
GCC releases, and Jakub's comment #3 it seems that when constructs like 
this work, it only does so by luck. 
 
So, this is not really a regression, and it is also not really going to 
be fixed in GCC. 
 
 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX
            Summary|[4.0/4.1 Regression] error: |unable to find a register to
                   |unable to find a register to|spill in class 'Q_REGS' with
                   |spill in class 'Q_REGS' with|-fPIC and -O2
                   |-fPIC and -O2               |


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


^ permalink raw reply	[flat|nested] 12+ 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
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (5 preceding siblings ...)
  2005-05-12 10:59 ` [Bug target/21518] " steven at gcc dot gnu dot org
@ 2005-05-12 12:00 ` pinskia at gcc dot gnu dot org
  2005-05-12 12:02 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-12 12:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-12 12:00 -------
But the orginal code did not have regparm so we should not be changing the function to regparm 3 
then.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |
            Summary|unable to find a register to|[4.0/4.1 Regression] unable
                   |spill in class 'Q_REGS' with|to find a register to spill
                   |-fPIC and -O2               |in class 'Q_REGS' with -fPIC
                   |                            |and -O2


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


^ permalink raw reply	[flat|nested] 12+ 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
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (6 preceding siblings ...)
  2005-05-12 12:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-05-12 12:02 ` pinskia at gcc dot gnu dot org
  2005-07-06 17:03 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-12 12:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-12 12:02 -------
The code around:
              /* We can't use regparm(3) for nested functions as these use
                 static chain pointer in third argument.  */
              if (DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
                regparm = 2;
              else
                regparm = 3;

should be changed to take -fPIC into effect.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


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


^ permalink raw reply	[flat|nested] 12+ 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
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (7 preceding siblings ...)
  2005-05-12 12:02 ` pinskia at gcc dot gnu dot org
@ 2005-07-06 17:03 ` mmitchel at gcc dot gnu dot org
  2005-07-26 23:38 ` steven at gcc dot gnu dot org
  2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-06 17:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-07-06 17:03 -------
Postponed until 4.0.2.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.1                       |4.0.2


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


^ permalink raw reply	[flat|nested] 12+ 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
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (8 preceding siblings ...)
  2005-07-06 17:03 ` mmitchel at gcc dot gnu dot org
@ 2005-07-26 23:38 ` steven at gcc dot gnu dot org
  2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-07-26 23:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-07-26 23:34 -------
Let's try the suggestion from comment #6. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-06-26 18:11:21         |2005-07-26 23:34:10
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ 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
  2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
                   ` (9 preceding siblings ...)
  2005-07-26 23:38 ` steven at gcc dot gnu dot org
@ 2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-11 19:54 [Bug c/21518] New: error: unable to find a register to spill in class 'Q_REGS' with -fPIC and -O2 couriousous at mandriva dot org
2005-05-11 19:57 ` [Bug target/21518] " pinskia at gcc dot gnu dot org
2005-05-11 21:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-11 21:23 ` pinskia at gcc dot gnu dot org
2005-05-11 21:24 ` pinskia at gcc dot gnu dot org
2005-05-12  8:59 ` jakub at gcc dot gnu dot org
2005-05-12 10:59 ` [Bug target/21518] " steven at gcc dot gnu dot org
2005-05-12 12:00 ` [Bug target/21518] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-12 12:02 ` pinskia at gcc dot gnu dot org
2005-07-06 17:03 ` mmitchel at gcc dot gnu dot org
2005-07-26 23:38 ` steven at gcc dot gnu dot org
2005-09-27 16:20 ` mmitchel 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).