[LLVMbugs] [Bug 2402] New: CBE generates wrong code for packed struct with long double

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jun 1 12:55:04 PDT 2008


           Summary: CBE generates wrong code for packed struct with long
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


target datalayout =
target triple = "i686-pc-linux-gnu"
        %struct.anon = type <{ x86_fp80, i8, i8 }>
@e = common global [100 x %struct.anon] zeroinitializer, align 4               
; <[100 x %struct.anon]*> [#uses=3]

define float @a(...) {
        %tmp = load x86_fp80* getelementptr ([100 x %struct.anon]* @e, i32 0,
i32 50, i32 0)            ; <x86_fp80> [#uses=1]
        %conv = fptrunc x86_fp80 %tmp to float          ; <float> [#uses=1]
        ret float %conv

Generated C code with "llc -march=c" (relevant bit):
/* Structure contents */
struct l_struct_2E_anon {
  long double field0;
  unsigned char field1;
  unsigned char field2;
} __attribute__ ((packed));

The LLVM struct is 12 bytes, while the converted one is 14 bytes on x86-Linux,
and 18 bytes on x86-64.

No idea how to fix this.

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