Re: [PATCH] C undefined behavior fix

Tom Rini
2002-01-01T23:44:43Z

On Wed, Jan 02, 2002 at 01:03:25AM +0200, Momchil Velikov wrote:

> The appended patch fix incorrect code, which interferes badly with
> optimizations in GCC 3.0.4 and GCC 3.1.
>
> The GCC tries to replace the strcpy from a constant string source with
> a memcpy, since the length is know at compile time.

Check the linuxppc-dev archives, but this has been discussed before, and
it came down to a few things.
1) gcc shouldn't be making this optimization, and Paulus (who wrote the
code) disliked this new feature. As a subnote, what you sent was sent
to Linus with a comment about working around a gcc-3.0 bug/feature, and
was rejected because of this.
2) We could modify the RELOC macro, and not have this problem. The
patch was posted, but not acted upon.
3) We could also try turning off this particular optimization
(-fno-builtin perhaps) on this file, and not worry about it.

--
Tom Rini (TR1265)