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: 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: sirl at gcc dot gnu dot org
- Date: 12 Jul 2001 11:39:46 -0000
Synopsis: Cann't boot kernel-2.4.6 with CVS gcc-3.0.1
State-Changed-From-To: feedback->analyzed
State-Changed-By: sirl
State-Changed-When: Thu Jul 12 04:39:45 2001
State-Changed-Why:
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"));
Note the length of the memcpy!
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;
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3609&database=gcc