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

             Bug #: 53942
           Summary: unable to find a register to spill in class 'CREG'
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ncahill_...@yahoo.com


This command:

gcc -O2 -mtune=pentium2 -fno-inline -x c++ -std=gnu++98 -c a.c -o a.o

gives this output:

### output ###
a.c: In function 'unsigned char _ZL1fP2S_h.isra.0(UINT16, UINT16, UINT16,
unsigned char)':
a.c:25:1: error: unable to find a register to spill in class 'CREG'
a.c:25:1: error: this is the insn:
(insn 11 7 12 2 (parallel [
            (set (reg:SI 1 dx [85])
                (ashiftrt:SI (reg:SI 1 dx [85])
                    (reg/v:QI 81 [ i ])))
            (clobber (reg:CC 17 flags))
        ]) a.c:20 409 {*ashrsi3_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
a.c:25: confused by earlier errors, bailing out
### end output ###

when compiling this testcase:

### a.c ###
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef struct S_ S;

struct S_ {
  UINT16 data[3];
  UINT32 x;
  UINT32 y;
};

static inline S *get_S() {}

static unsigned char f(S *s, unsigned char i) 
{
  unsigned char c=0;
  unsigned char v;

  v = s->data[0]; 
  c|=v;
  v=((s->data[1])&(1<<i))?1:0; 
  c|=v<<1;
  v=((s->data[2])&0xff)&(1<<i); 
  c|=v<<2;
  return c;
}

void g() 
{
  S *s = get_S();
  s->x=f(s,6);
  s->y=f(s,7);
}
### end a.c ###

Using -mtune=i686 works.  I'm using gcc 4.7.1, i686-pc-linux-gnu, 32-bit.

Thank you.
Neil.

Reply via email to