Re: [PATCH] C undefined behavior fix

From: Florian Weimer (
Date: Fri Jan 04 2002 - 03:48:04 EST

Paul Mackerras <> writes:

> Richard Henderson writes:
>> On Thu, Jan 03, 2002 at 01:33:27PM +1100, Paul Mackerras wrote:
>> > I look forward to seeing your patch to remove all uses of
>> > virt_to_phys, phys_to_virt, __pa, __va, etc. from arch/alpha... :)
>> I don't dereference them either, do I?
> Does that matter?

No, it doesn't. C pointers do not behave like machine addresses,
there are additional constraints.

> Also, what does the standard say about casting pointers to integral
> types? IIRC you aren't entitled to assume that a pointer will fit in
> any integral type, or anything about the bit patterns that you get.

This casting falls into the category "additional language constructs
supported by GCC". The standard contains wording which encourages
implementors to include a meaningfull conversion from a pointer type
to an integral type, but there is no requirement that this has the
semantics expected by most programmers.
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 : Mon Jan 07 2002 - 21:00:24 EST