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]
Other format: [Raw text]

[Bug other/23123] New: compiler emits useless local symbol (initializer).


$ arm-linux-eabi-gcc foo.c -Wall -S -O2   
   
unsigned foo(unsigned* ptr)   
{   
    union {   
        unsigned long long v64;   
        struct { unsigned a, b; } v32;   
    } tmp = { 0 };                     <= this initialization was 
                                          eliminated by optimizer 
                                          but initializer was 
                                          emited into .rodata. 
    tmp.v32.a = *ptr;   
    return tmp.v32.a;   
}   
   
        .file   "foo.c"   
        .section        .rodata   
        .align  3   
        .type   C.0.1149, %object   
        .size   C.0.1149, 8   
C.0.1149:                                   <== useless data. 
        .space  8                           <== 
        .text   
        .align  2   
        .global foo   
        .type   foo, %function   
foo:   
        ldr     r0, [r0, #0]   
        bx      lr   
        .size   foo, .-foo   
        .ident  "GCC: (GNU) 4.0.1"

-- 
           Summary: compiler emits useless local symbol (initializer).
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pld-linux
  GCC host triplet: i686-pld-linux
GCC target triplet: arm-linux-eabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23123


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