[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


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

           Summary: CBE generates wrong code for packed struct with long
                    double
           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


Testcase:

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
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(...) {
entry:
        %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