<html>
    <head>
      <base href="http://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 --- - Incorrect code for accessing a struct variable with bit fields"
   href="http://llvm.org/bugs/show_bug.cgi?id=16551">16551</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect code for accessing a struct variable with bit fields
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ishiura-compiler@ml.kwansei.ac.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang 3.4 (based on LLVM 3.4svn) for x86_64 target miscompiles the
following code.

  $ cat error.c 

  struct S1 {
    unsigned int m1 : 32;
    unsigned int m2 : 24;
    unsigned char m3;
  };

  struct S1 x = { 1U, 1U, 1U };

  int main(void)
  {
    if ( x.m2 != 1U ) __builtin_abort(); 
    return 0;
  }

  $ clang error.c
  $ ./a.out
  Abort trap: 6

The value of the x.m2 was 16777217 (x01000001). 

There was no problem with an x86 (32bit) target.</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>