This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Tom Rini <trini at kernel dot crashing dot org>
- To: Momchil Velikov <velco at fadata dot bg>
- Cc: linux-kernel at vger dot kernel dot org, gcc at gcc dot gnu dot org,linuxppc-dev at lists dot linuxppc dot org,Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>,Paul Mackerras <paulus at samba dot org>,Benjamin Herrenschmidt <benh at kernel dot crashing dot org>,Corey Minyard <minyard at acm dot org>
- Date: Wed, 2 Jan 2002 12:09:10 -0700
- Subject: Re: [PATCH] C undefined behavior fix
- References: <email@example.com>
On Wed, Jan 02, 2002 at 01:03:25AM +0200, Momchil Velikov wrote:
> The GCC tries to replace the strcpy from a constant string source with
> a memcpy, since the length is know at compile time.
Okay, here's a summary of all of the options we have:
1) Change this particular strcpy to a memcpy
2) Add -ffreestanding to the CFLAGS of arch/ppc/kernel/prom.o (If this
optimization comes back on with this flag later on, it would be a
compiler bug, yes?)
3) Modify the RELOC() marco in such a way that GCC won't attempt to
optimize anything which touches it . (Franz, again by Jakub)
4) Introduce a function to do the calculations . (Corey Minyard)
5) 'Properly' set things up so that we don't need the RELOC() macros
(-mrelocatable or so?), and forget this mess altogether.
I think that if we're going to make sure that gcc-3.0.x works with 2.4.x
kernels, we should pick one of the first 4 initially. If this is only a
2.5.x matter, we should probably try and do #5 as a long-term goal, and
pick something else for now. But either way I do think it's time to
pick some solution. Comments?
Tom Rini (TR1265)