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

From: Linus Torvalds (
Date: Sun Jun 15 2003 - 21:44:55 EST

On Mon, 16 Jun 2003, Rusty Russell wrote:
> AFAICT, Roman's fix is correct; Richard admonished me in the past for
> such code, IIRC, but this one slipped through.

Roman's fix is fine, but the fact is, the original code was also fine.
Yes, the C standard has all these rules about "within objects" for pointer
differences, but the "objects" themselves can come from outside the
compiler. As they did in this case.

(Yeah, I could see the compiler warning about cases it suspects might be
separate objects, but the end result should still be the right one).

In general, I accept _local_ uglifications to work around compiler
problems. But I do not accept non-local stuff like making for ugly calling
conventions etc, which is why Andi's original patch was not acceptable to

It turns out that the real bug was somewhere in the tool chain, and the
linker should either honor alignment requirements or warn about them when
it cannot. I suspect in this case the alignment requirement wasn't
properly passed down the chain somewhere, I dunno. The problem is fixed,
but for future reference please keep this in mind when working around
compiler problems.

If worst comes to worst, we'll have notes about certain compiler versions
just not working. It's certainly happened before.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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