[PATCH] C undefined behavior fix
Richard Henderson
rth@redhat.com
Sat Jan 5 10:50:00 GMT 2002
On Sat, Jan 05, 2002 at 09:55:50AM -0800, Dennis Ferguson wrote:
> Sometimes I know what "foo" + 5 points to. If we're talking about
> the more general case of converting pointers to an integer representation
> of their bits, doing math on that, and converting the result back
> to a pointer ...
We're not talking about the general case. An object that the compiler
knows about (either global, file scope static, or on the stack) must be
involved.
> ... then both device drivers and memory allocators often
> depend on being able to do that fairly freely.
The heap is a different animal, since there we don't know what the
outer-most object really is, so we can't make the same inferences
that we can with compiler controlled objects.
In general, device drivers and memory managers should be safe.
r~
More information about the Gcc
mailing list