https://llvm.org/bugs/show_bug.cgi?id=30280

            Bug ID: 30280
           Summary: PowerPC64: issue passing packed bitfield to function
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedb...@nondot.org
          Reporter: an...@samba.org
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

I was looking at a csmith fail with packed bitfields. A reduced test case looks
like:

#pragma pack(1)
struct S0 {
        unsigned int f1;
        unsigned int f2 : 31;
        unsigned int f3 : 7;
};

int foo(struct S0 a)
{
        return a.f3;
}

-O0 looks ok, but at -O1 and above we seem to pull the last byte out of the
wrong spot on the stack:

    std 3, -24(1)
    stb 4, -16(1)
    ori 2, 2, 0
    lbz 3, -20(1)    <---- expecting offset -16
    lwz 4, -20(1)
    sldi 3, 3, 32
    or 3, 4, 3
    rldicl 3, 3, 33, 57
    blr

It also seems a bit silly to do all this work when the values were in GPRs to
start with.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to