[LLVMbugs] [Bug 1419] NEW: llvm-gcc PaddingElement optimization results in valid fields not being copied

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon May 14 19:58:30 PDT 2007


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

           Summary: llvm-gcc PaddingElement optimization results in valid
                    fields not being copied
           Product: new-bugs
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr


Test case:

struct A {
  short x;
  long long :0;
};

struct B {
  char a;
  char b;
  unsigned char i;
};

union X { struct A a; struct B b; };

int check(void) {
  union X x, y;

  y.b.i = 0xff;
  x = y;
  return (x.b.i == 0xff);
}

When compiled with -O2:

define i32 @check() {
entry:
        ret i32 0
}

It should return 1.  This is because the X.i field is not
being copied by the aggregate copy, since it lives inside
the padding of struct A.



------- 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