<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 does not fully grok 'register asm("x")' declarations for powerpc"
   href="https://bugs.llvm.org/show_bug.cgi?id=44435">44435</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang does not fully grok 'register asm("x")' declarations for powerpc
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>chmeeedalf@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This may be a general bug, but I've only tested on powerpc64.

libreoffice uses asm register allocations a'la:

register long r3 asm("r3");

With gcc, it allocates register r3 to the variable, but clang ignores the asm
bit, and treats it as an uninitialized variable, leading to crashes in
libreoffice.

A trivial example program:

#include <stdio.h>

int main(int argc, char **argv)
{
        register long x asm("r3");

        printf("%ld, %d\n", x, argc);
        return (0);
}


Built with clang:
[chmeee@ralga:pts/12]:~> ./test_regasm
4611686018427378136, 1

Built with gcc9:
[chmeee@ralga:pts/12]:~> ./test_regasm
1, 1

r3 on entry is argc, so it should print 1 for both arguments.</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>