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 609 - [llvmgcc] Incorrect parameter passing ABI when passing structs with FP elements by value
Summary: [llvmgcc] Incorrect parameter passing ABI when passing structs with FP elemen...
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: llvm-gcc (show other bugs)
Version: 1.4
Hardware: Macintosh MacOS X
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2005-07-27 16:42 PDT by Chris Lattner
Modified: 2010-02-22 12:51 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 Chris Lattner 2005-07-27 16:42:32 PDT
llvm-gcc currently miscompiles this on darwin:

typedef struct {
  double re,im;
} DComplex;
void bar(DComplex *P, void (*FP)(DComplex)) {
  FP(*P, *P);
}

The prototype it emits for "FP" is:

void (double, double)* %FP

Unfortunately, darwin requires structs to be passed in integer regs regardless of whether the incoming 
values are FP or not.  This means the prototype should be:

void (long, long)* %FP

or 

void (int, int, int, int)* %FP

... yuck.

-Chris
Comment 1 Chris Lattner 2005-07-28 13:53:48 PDT
Fixed.  Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050725/027274.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050725/027275.html

This fixes 252.eon, 168.wupwise, 178.galgel, and 301.apsi on Darwin.

-Chris