<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 --- - PPC32: Base pointer clobbered with -fPIC"
   href="http://llvm.org/bugs/show_bug.cgi?id=22115">22115</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PPC32: Base pointer clobbered with -fPIC
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>marcus@mc.pp.se
          </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>Created <span class=""><a href="attachment.cgi?id=13646" name="attach_13646" title="Output from clang -fPIC -S for foo.c">attachment 13646</a> <a href="attachment.cgi?id=13646&action=edit" title="Output from clang -fPIC -S for foo.c">[details]</a></span>
Output from clang -fPIC -S for foo.c

clang uses R30 as a pointer to a compilation-unit specific constant pool, but
does not save it in either the caller or callee in cross-compilation-unit
calls.

If the following example:

--8<-- foo.c --8<--
#include <stdio.h>

int foo()
{
  fprintf(stderr, "Two\n");
  return 0;
}

void dummy()
{
  fprintf(stderr, "Gotcha\n");
}
--8<-- bar.c --8<--
#include <stdio.h>
extern int foo(void);

int bar()
{
  fprintf(stderr, "One\n");
  int r = foo();
  fprintf(stderr, "Three\n");
  return r;
}
--8<--

is compiled with -fPIC, the output printed by bar() becomes

One
Two
Gothca

instead of the correct

One
Two
Three

Attaching assembler code generated by clang.</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>