[LLVMbugs] [Bug 4947] New: LLVM-GCC generates wrong type for GV zeroinitializer ( LLVM 2.6 regression)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Sep 11 00:40:58 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4947

           Summary: LLVM-GCC generates wrong type for GV zeroinitializer
                    (LLVM 2.6 regression)
           Product: new-bugs
           Version: 2.6
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jlerouge at apple.com
                CC: llvmbugs at cs.uiuc.edu


Using LLVM-GCC that comes with LLVM 2.6, the following C code:

typedef struct {
    char a;
    int b;
} foo;

foo myFoo[1] = {{0}};

generates the following IR using llvm-gcc -c -emit-llvm:

%0 = type { i8, [7 x i8] }
%struct.foo = type { i8, i32 }
@myFoo = global [1 x %0] zeroinitializer, align 4

The expected result is (what LLVM-GCC 2.5 gives):

%struct.foo = type { i8, i32 }
@myFoo = global [1 x %struct.foo] zeroinitializer

so that myFoo ends up having the correct type ([1 x %struct.foo]*).

If myFoo is completely initialized, the behaviour is correct:

typedef struct {
    char a;
    int b;
} foo;

foo myFoo[1] = {{0, 0}};

will give:

%struct.foo = type { i8, i32 }
@myFoo = global [1 x %struct.foo] zeroinitializer

Thanks,
Julien


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list