public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Schmid <schmid@ltoi.iap.physik.tu-darmstadt.de>
To: egcs@cygnus.com
Subject: Re: Linux and EGCS
Date: Mon, 15 Dec 1997 17:27:00 -0000	[thread overview]
Message-ID: <Pine.A32.3.95.971216022651.18974A-100000@ltoi.iap.physik.tu-darmstadt.de> (raw)

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$ 


             reply	other threads:[~1997-12-15 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-15 17:27 Peter Schmid [this message]
1997-12-15 18:25 ` Richard Henderson
1997-12-15 22:21 ` Jeffrey A Law
     [not found] <9712121715.AA19735@kona.>
1997-12-15  7:49 ` Jeffrey A Law
1997-12-15 12:14   ` Paul Koning
     [not found] <9712101650.AA16396@kona.>
1997-12-10 10:58 ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.A32.3.95.971216022651.18974A-100000@ltoi.iap.physik.tu-darmstadt.de \
    --to=schmid@ltoi.iap.physik.tu-darmstadt.de \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).