This is the mail archive of the gcc@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]

Re: Linux and EGCS




I applied the patch stmt.c (expand_asm_operands).
I thought it would fix the problems compiling linux-2.1.72. 
The compilation crashes on process.c in the arch/i386/kernel
directory. The compiler stops in the function flush_thread(void).
The strange thing is the success of the compilation depends on the
optimization level. Without optimization the compiler crashes, with -O
it works, with -O2 it does not work and with -O2 -fno-strenght-reduce it
works.

Peter Schmid

cat t.c

extern struct desc_struct *idt, *gdt;

struct Xgt_desc_struct {
	unsigned short size;
	unsigned long address __attribute__((packed));
};
extern struct desc_struct default_ldt;
struct desc_struct {
	unsigned long a,b;
};

void flush_thread(void)
{
    int i;
    for (i=1 ; i< 512  ; i++) {
        {
            __asm__ __volatile__ ("movw $" "(( 1 << 3) - 1)" ",%1\n\t" "movw %%ax,%2\n\t" "rorl $16,%%eax\n\t" "movb %%al,%3\n\t" "movb $"  "0x82"  ",%4\n\t" "movb $0x00,%5\n\t" "movb %%ah,%6\n\t" "rorl $16,%%eax" : :"a" ( ((int)( &default_ldt )) ), "m" (
*( ((char *) ( gdt+(i<<1)+
                                                                                                                                                                                                                                                               
               (8 +1)  )) )), "m" (*( ((char *) ( gdt+(i<<1)+ 					     (8 +1)  )) +2)), "m" (*( ((char *) ( gdt+(i<<1)+ 					     (8 +1)  )) +4)), "m" (*( ((char *) ( gdt+(i<<1)+ 					     (8 +1)  )) +5)), "m" (*( ((char *) ( gdt+(i<<1)+ 					     (8 +1)
  )) +6)), "m" (*( ((char *) ( gdt+(i<<1)+ 					     (8 +1)  )) +7)) )  ;
            __asm__ __volatile__("lldt %%ax":   :"a" (((((unsigned long)   i  )<<4)+((8 +1) <<3)) )) ;
        }
    }	
}

peter:/dos/tmp$ gcc -c -W -Wall t.c
t.c: In function `flush_thread':
t.c:22: fixed or forbidden register 7 (sp) was spilled for class GENERAL_REGS.
This may be due to a compiler bug or to impossible asm
statements or clauses.
peter:/dos/tmp$ gcc -O -c -W -Wall t.c
peter:/dos/tmp$ gcc -O2 -c -W -Wall t.c
t.c: In function `flush_thread':
t.c:22: fixed or forbidden register 7 (sp) was spilled for class GENERAL_REGS.
This may be due to a compiler bug or to impossible asm
statements or clauses.
peter:/dos/tmp$ gcc -O2 -fno-strength-reduce -c -W -Wall t.c
peter:/dos/tmp$ 



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