asm operand requires impossible reload

Lars Poeschel larsi@wh2.tu-dresden.de
Thu Feb 1 01:05:00 GMT 2007


> > When I compile this c-File I get this error in the line, where the macro
> > is used:
> >
> > asm operand requires impossible reload
> >
> > What does this error message mean ?
>
> It means that the compiler was unable to find a register to use.  It's
> a strange error to get for an asm like this.  You may need to put
> together a complete small test case.

I could strip down my file to the attached example. Removing more instructions 
or types causes the error to disappear.
In my last mail I forgot to mention that I use the fr30 version of gcc 4.1.1 
(3.4.6) did not have the problem. The problem is in line 30.

> > If I compile using the -S switch, the generated assembler file looks fine
> > and the inline assembler is inserted right.
>
> That doesn't make sense.  If you get the error without -S, you should
> get the error with -S.

That would indeed be very strange. It was my fault. I was trying with 
different options and missed to delete temporary files. With option -da I get 
files until *.c.58.shorten

As I can imagine not everybody wants to build fr30 gcc to reproduce the error, 
I will post the part of c.58.shorten, that I think is relevant:

(note 188 21 23 ( __chan (expr_list:REG_DEP_TRUE (reg/v/f:SI 9 r9 [orig:43 
__chan ] [43])
    (const_int 0 [0x0]))) NOTE_INSN_VAR_LOCATION)

(note:HI 23 188 24 ("hal_if3.c") 30)

(insn:HI 24 23 122 hal_if3.c:30 (set (reg:SI 1 r1)
        (asm_operands/v:SI ("st   r1, @-r15 ;
mov   ps,     r1 ;
ldi:8 #0x10,  %0 ;
and   r1,     %0 ;
lsr   #1,     %0 ;
ld    @r15+,  r1 ;
andccr #0xef 
") ("=r") 0 []
             [] ("hal_if3.c") 30)) -1 (nil)
    (expr_list:REG_UNUSED (reg:SI 1 r1)
        (nil)))

(note:HI 122 24 147 NOTE_INSN_DELETED)

(insn 147 122 126 (set (reg:SI 2 r2)
        (reg/v/f:SI 9 r9 [orig:43 __chan ] [43])) 6 {movsi_internal} (nil)
    (nil))

You see the inline instructions with the %0 placeholder. What wants the 
compiler to do next ? As I read the RTL the compiler already choose r2 for 
the output variable r. It only has to replace the %0 by r2. What is its 
problem here ? Is there happening another reload pass ?

Thank you very much for your help,

Lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal_if3.c
Type: text/x-csrc
Size: 2001 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20070201/a7e3c8de/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20070201/a7e3c8de/attachment.sig>


More information about the Gcc-help mailing list