[llvm-bugs] [Bug 30280] New: PowerPC64: issue passing packed bitfield to function

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 5 06:03:33 PDT 2016


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: unassignedbugs at nondot.org
          Reporter: anton at samba.org
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160905/e9fd152e/attachment.html>


More information about the llvm-bugs mailing list