Re: Kernel Bug in 2.4.35 when compiled gcc>=4.2.0 and -march=c3

From: Willy Tarreau
Date: Mon Aug 06 2007 - 09:31:53 EST


On Mon, Aug 06, 2007 at 03:05:29PM +0200, Segher Boessenkool wrote:
> >I still
> >suspect that because the behaviour is different between 4.1 and 4.2, it
> >might be a regression in 4.2,
>
> The kernel code is wrong. It might have accidentally worked
> with GCC-4.1, but that doesn't mean GCC-4.2 has regressed.
> Only supported features that stop working are regressions;
> invalid code that stops working is, well, in the worst case
> an improvement in diagnostics ;-)

Just to enlighten me on the subject, could you please explain me
what is wrong in the code ? Granted I found it awful, but even on
the GCC-4.2 page where -fno-toplevel-reorder is explained, it is
said that asm statements can be instantiated between functions
blocks, which is exactly what is used here.

Also, I could reproduce the problem with gcc 4.1 by simply declaring
the interrupts[] array before the asm statements. It looks like the
asm statements simply continue in the next section as the previously
instantiated block. Maybe ".section .text" should be explicitly noted
in each asm statement, but that seems strange to me.

Right now, I just removed -fno-unit-at-a-time which had been added
only for gcc-3.4, and it fixed gcc-4.2 (and even 4.1 produces cleaner
code after that).

Regards,
Willy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/