<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 --- - clang generates invalid assembly on ppc64le"
   href="https://llvm.org/bugs/show_bug.cgi?id=28102">28102</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang generates invalid assembly on ppc64le
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kb9vqf@pearsoncomputing.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16523" name="attach_16523" title="Test case">attachment 16523</a> <a href="attachment.cgi?id=16523&action=edit" title="Test case">[details]</a></span>
Test case

When building a large, proprietary codebase against ppc64le for the first time,
clang generated an invalid intermediate assembly file.

Reducing the failing code as much as possible yielded the attached test case. 
It generates a significant amount of assembler output, but the most critical
section is:

.L0_0_set_4294967295 = ".LBB0_-1"-.LJTI0_0
.L0_0_set_3 = .LBB0_3-.LJTI0_0
.L0_0_set_4 = .LBB0_4-.LJTI0_0
.L0_0_set_5 = .LBB0_5-.LJTI0_0

There appears to be integer wrap-around causing an invalid .LBB label to be
generated.  Reducing the number of the case statements in the switch block
resolved the failure, and the failure remained when adding additional
statements, implying clang is not handling anything over 5 statements correctly
in this case.

clang arguments were:
-fPIC -Wno-switch -Wno-unused-value -fvisibility=hidden -DNDEBUG -g -O2 -v
-save-temps -std=c++11

The relevant sections of the generated assembler file are attached.  I (likely)
cannot post code outside of the provided sections due to license restrictions
on the codebase.

Please let me know if you  need any further information!</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>