[LLVMbugs] [Bug 1548] NEW: Problem with packed structs on targets that doesn't support unaligned memory access

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jul 11 14:45:37 PDT 2007


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

           Summary: Problem with packed structs on targets that doesn't
                    support unaligned memory access
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: lauro.venancio at gmail.com


test case:

#include <stdio.h>

struct t {
  char a;
  int b;
} __attribute__ ((packed));


struct t s = { 1, 10 };

int main(){
  printf("It must print 10!\n");
  printf("%d\n", s.b);
  return 0;
}

emitted code (ARM):

main:
        stmfd sp!, {r11, lr}
        ldr r0, .LCPI1_0
        bl puts
        ldr r3, .LCPI1_1
        ldr r1, [r3, #+1] <======== unaligned load (invalid) 
        ldr r0, .LCPI1_2
        bl printf
        mov r0, #0
        ldmfd sp!, {r11, pc}


If a value is unaligned, we must build it using some byte loads.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list