This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/3609: Cann't boot kernel-2.4.6 with CVS gcc-3.0.1


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]