<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - PowerPC64: issue passing packed bitfield to function"
   href="https://llvm.org/bugs/show_bug.cgi?id=30280">30280</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC64: issue passing packed bitfield to function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: PowerPC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>anton@samba.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>