<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 - Passing long double args on 32-bit SPARC violates ABI"
   href="https://bugs.llvm.org/show_bug.cgi?id=42493">42493</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Passing long double args on 32-bit SPARC violates ABI
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Sun
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Solaris
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>ABI, miscompilation
          </td>
        </tr>

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

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

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

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

        <tr>
          <th>Reporter</th>
          <td>ro@gcc.gnu.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, venkatra@cs.wisc.edu
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm current working to fix the remaining compiler-rt testsuite bugs on SPARC
(<a href="https://reviews.llvm.org/D40900">https://reviews.llvm.org/D40900</a>).  One of the failures is

    Builtins-sparc-sunos :: divtc3_test.c
    Builtins-sparcv9-sunos :: divtc3_test.c

While the sparcv9 failure is different, the sparc one boils down to incorrectly
passing long double arguments.  Consider the following testcase:

$ cat caller.c
extern void callee (long double);

int
main (void)
{
  long double ld = 1.0;

  callee (ld);
  return 0;
}
$ cat callee.c
extern void abort (void);

void
callee (long double ld)
{
  if (ld != 1.0)
    abort ();
}
$ clang -m32 -c caller.c -o caller.clang.o
$ clang -m32 -c callee.c -o callee.clang.o
$ gcc -m32 -c caller.c -o caller.gcc.o
$ gcc -m32 -c callee.c -o callee.gcc.o
$ gcc -m32 -o clang-gcc caller.clang.o callee.gcc.o 
$ ./clang-gcc 
Segmentation Fault (core dumped)
$ gcc -m32 -o gcc-clang caller.gcc.o callee.clang.o 
$ ./gcc-clang 
Abort (core dumped)

The SPARC psABI, p.3-15 (Structure, Union, and Quad-Precision Arguments)
requires long double args to be passed by reference, while clang passes
them by value (as is correct for SPARCv9).</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>