Re: [PATCH] C undefined behavior fix

From: Tom Rini (trini@kernel.crashing.org)
Date: Wed Jan 02 2002 - 21:10:21 EST


On Thu, Jan 03, 2002 at 12:35:30AM +0000, David Woodhouse wrote:
>
> (cc list trimmed)
>
> alan@lxorguk.ukuu.org.uk said:
> > If you want a strcpy that isnt strcpy then change its name or use a
> > different language 8)
>
> The former is not necessarily sufficient in this case. You've still done the
> broken pointer arithmetic, so even if the function isn't called strcpy() the
> compiler is _still_ entitled to replace it with a call to memcpy() or even
> machine_restart() before sleeping with your mother and starting WW III.
>
> Granted, it probably _won't_ do any of those today, but you should know
> better than to rely on that.
>
> What part of 'undefined behaviour' is so difficult for people to understand?

I think it comes down to an expectation that if the behaviour is
undefined, anything _could_ happen, but what should happen is that it
should just be passed along to (in this case) strcpy un-modified.
Anything _could_ happen, but why do something that probably won't help
all the same?

But this is moot anyhow since I _think_ Paul's suggestion of doing RELOC
and friends as asm will work (and echo'd by rth?).

-- 
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
-
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 : Mon Jan 07 2002 - 21:00:19 EST