Re: linux-2.1.103 crashes egcs-19980517 on i586

Horst von Brand (
Thu, 21 May 1998 23:00:42 -0400 (Linus Torvalds) said:
> In article <>,
> Horst von Brand <> wrote:

> >This compiler (and egcs-19980508 at least) crash on
> >linux/arch/i386/kernel/bios32.c:check_pcibios. A presumably safe workaround
> >follows (adding __volatile__ just disallows moving the asm() around, and as
> >it stands, there shouldn't be any place to move it too ;-)

> >--- linux/arch/i386/kernel/bios32.c.dist Thu May 21 11:27:05 1998
> >+++ linux/arch/i386/kernel/bios32.c Thu May 21 15:00:52 1998
> >@@ -543,7 +543,7 @@
> > pci_indirect.address = pcibios_entry + PAGE_OFFSET;
> >
> > save_flags(flags); cli();
> >- __asm__("lcall (%%edi)\n\t"
> >+ __asm__ __volatile__("lcall (%%edi)\n\t"
> > "jc 1f\n\t"
> > "xor %%ah, %%ah\n"
> > "1:"

> If this patch makes any difference, the compiler is buggy.

Exactly my diagnosis, that's why I reported the problem to egcs-bugs.

> The asm is surrounded by
> cli();
> .. asm ..
> restore_flags();
> and both of those are either defined to be volatile asm's (for UP case)
> or to be function calls (for SMP). In either case gcc is _not_ legally
> supposed to move the __asm__ with the lcall around them: the lcall asm
> is has a "memory" modifier to mark that it can change memory.

> I've added the __volatile__ to my tree because it won't hurt, but these
> kinds of continuing problems with egcs miscompiling the kernel make me
> nervous. And it makes me irritated that people _continue_ to patch the
> kernel instead of trying to fix the compiler.

Sorry about that. I don't want to "fix" Linux here, Linux is fine as it
stands. I'd much prefer to fix the compiler, which is clearly broken. OTOH,
I understand a fair bit about Linux, and next to nothing whatsoever about
the guts of gcc. And it is usually easier to find a workaround in the
source (as in this case) than to fix the broken compiler... perhaps I
should have made that point clearer.

But AFAIR, this is the first genuine egcs bug I've seen triggered by
Linux. All the other problems I saw were due to bad code in the kernel.

As things stand, I'd say the next gcc will be egcs. Today Cygnus announced
that they donated a mayor improvement in optimization to the egcs proyect,
just last week new data alignment code was integrated that is claimed to
give a 30% (!) improvement on some SPEC benchmarks. RedHat has asked the
egcs crew to fix several bugs in egcs-1.0.2 for their 5.1 distribution,
giving rise to egcs-1.0.3a. I'm thinking it's better to check it out before
it is what everybody and her baby brother are using ;-)

Horst von Brand                   
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to