This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Joe Buck <jbuck at synopsys dot COM>
- To: trini at kernel dot crashing dot org (Tom Rini)
- Cc: velco at fadata dot bg (Momchil Velikov), linux-kernel at vger dot kernel dot org,gcc at gcc dot gnu dot org, linuxppc-dev at lists dot linuxppc dot org,Franz dot Sirl-kernel at lauterbach dot com (Franz Sirl),paulus at samba dot org (Paul Mackerras),benh at kernel dot crashing dot org (Benjamin Herrenschmidt),minyard at acm dot org (Corey Minyard)
- Date: Wed, 2 Jan 2002 12:13:34 -0800 (PST)
- Subject: Re: [PATCH] C undefined behavior fix
> 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 [1]. (Franz, again by Jakub)
> 4) Introduce a function to do the calculations [2]. (Corey Minyard)
> 5) 'Properly' set things up so that we don't need the RELOC() macros
> (-mrelocatable or so?), and forget this mess altogether.
2) will prevent any future gcc from ever assuming it can transform the
strcpy into anything but a call to strcpy, or assume anything about the
semantics of strcpy. Be careful with 3), as trying to fool the optimizer
is likely to be only a temporary solution (meaning that the kernel people
will return to flame the gcc people when the optimizer gets changed
again).