Messages in this thread | | | Date | Sun, 15 Jun 2003 19:44:55 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH] Fix undefined/miscompiled construct in kernel parameters |
| |
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 me.
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.
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/
| |