LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1064 - ppc linux doesn't handle float parameter to varargs function
Summary: ppc linux doesn't handle float parameter to varargs function
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: PowerPC (show other bugs)
Version: trunk
Hardware: Macintosh Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2006-12-22 10:27 PST by Nick Lewycky
Modified: 2010-02-22 12:43 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2006-12-22 10:27:06 PST
The Linux ABI requires that you set control register 6 before calling a variadic
function with a float parameter. Similarly, it recommends that you clear it
before calling a variadic function without one.

A simple example is:

  #include <stdio.h>
  int main(void) {
    printf("%f\n", 1.2);
    return 0;
  }

which will print "0.0" on PPC Linux. In the assembly, right before "bl printf",
add "creqv 6,6,6" and it will work properly. This fix will require changes to
the PPCISelLowering.cpp:LowerCALL function.
Comment 1 Nick Lewycky 2007-03-03 12:14:05 PST
This works now, presumably through the many Linux/PPC patches by Nicolas Geoffray.