Re: [PATCH] Fix undefined/miscompiled construct in kernel parameters

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Jun 15 2003 - 12:24:13 EST


On Sun, 15 Jun 2003, Andi Kleen wrote:
>
> Because &arbitary_symbol_a - &arbitary_symbol_b is undefined in C and
> the amd64 gcc 3.2 choses to miscompile it (it results in a very big
> number because it converts the 56/40 division to an inversed multiplication
> in a wrong way). I actually wrote a compiler bug report first, but the
> compiler developers rightly pointed out that it is undefined.

They are not arbitrary symbols. They are symbols in the same data
structure, set up by the linker script. Gcc doesn't know that, but the
fact that gcc doesn't know doesn't mean that gcc should be lazy and
doesn't really excuse buggy code.

The gcc developers you talked to are picking their legalistic noses, and
it's sad that this isn't exactly the first time it has happened.

                Linus

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



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:42 EST