public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
[parent not found: <9712121715.AA19735@kona.>]
* Re: Linux and EGCS
@ 1997-12-15 17:27 Peter Schmid
  1997-12-15 18:25 ` Richard Henderson
  1997-12-15 22:21 ` Jeffrey A Law
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Schmid @ 1997-12-15 17:27 UTC (permalink / raw)
  To: 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$ 


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

end of thread, other threads:[~1997-12-15 22:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9712101650.AA16396@kona.>
1997-12-10 10:58 ` Linux and EGCS Linus Torvalds
     [not found] <9712121715.AA19735@kona.>
1997-12-15  7:49 ` Jeffrey A Law
1997-12-15 12:14   ` Paul Koning
1997-12-15 17:27 Peter Schmid
1997-12-15 18:25 ` Richard Henderson
1997-12-15 22:21 ` Jeffrey A Law

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).