This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

BUG: gcc-2.9x with -O2 and non cdecl calling convention


Hello!

I tried to compile following code in gcc version 2.95.2 with -O2 optimization:

#define __FASTCALL__ __attribute__ (( __regparm__(3) , __stdcall__ ))
unsigned long __FASTCALL__ my_func(unsigned long v,unsigned long a)
{
 unsigned long i;
 i = v / a;
 if(v % a) v = ( v / i ) * i;
 return v;
}

but compiler said:

bug.c: In function `my_func':
bug.c:10: fixed or forbidden register 1 (dx) was spilled for class DREG.
bug.c:10: This may be due to a compiler bug or to impossible asm
bug.c:10: statements or clauses.
bug.c:10: This is the instruction:
(insn 14 12 19 (parallel[ 
            (set (reg:SI 1 %edx)
                (udiv:SI (reg/v:SI 0 %eax)
                    (reg:SI 1 %edx)))
            (set (reg:SI 2 %ecx)
                (umod:SI (reg/v:SI 0 %eax)
                    (reg:SI 1 %edx)))
        ] ) 252 {udivmodsi4} (insn_list 5 (nil))
    (expr_list:REG_DEAD (reg:SI 1 %edx)
        (nil)))

Btw, with -O1 optimization everything o'k.

Best regards! Nick





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]