This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/3609: Cann't boot kernel-2.4.6 with CVS gcc-3.0.1
- To: mmitchel at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org,gcc-prs at gcc dot gnu dot org,k_fukui at highway dot ne dot jp,nobody at gcc dot gnu dot org
- Subject: Re: c/3609: Cann't boot kernel-2.4.6 with CVS gcc-3.0.1
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Thu, 12 Jul 2001 00:07:05 +0200
- References: <20010711175053.9839.qmail@sourceware.cygnus.com>
On Wednesday 11 July 2001 19:50, mmitchel@gcc.gnu.org wrote:
> Synopsis: Cann't boot kernel-2.4.6 with CVS gcc-3.0.1
>
> State-Changed-From-To: open->feedback
> State-Changed-By: mmitchel
> State-Changed-When: Wed Jul 11 10:50:52 2001
> State-Changed-Why:
> Unreproducible.
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3609&database=gcc
I have the same problem and tracked it down to a misoptimization of the
strcpy function.
This code:
strcpy(namep, (*((typeof(&("linux,phandle")))((unsigned
long)(&("linux,phandle")) + offset))));
gets misoptimized to:
memcpy(namep, (*((typeof(&("linux,phandle")))((unsigned
long)(&("linux,phandle")) + offset))), offset - sizeof("linux,phandle"));
inspection of the assembly shows that it happens both on powerpc-linux-gnu
and x86-linux-gnu independent of -fstrict-aliasing and -fno-builtins.
gcc-2.95 compiles this just fine, so this is a regression.
Franz.
extern char * strcpy(char *,const char *);
extern unsigned long reloc_offset(void);
void inspect_node(void)
{
char *namep;
unsigned long offset = reloc_offset();
strcpy(namep, (*((typeof(&("linux,phandle")))((unsigned
long)(&("linux,phandle")) + offset))));
return;
}