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

sirl@gcc.gnu.org sirl@gcc.gnu.org
Thu Jul 12 04:39:00 GMT 2001


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



More information about the Gcc-bugs mailing list