Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvmgcc] Incorrect parameter passing ABI when passing structs with FP elements by value #981

Closed
lattner opened this issue Jul 27, 2005 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla llvm-tools All llvm tools that do not have corresponding tag miscompilation

Comments

@lattner
Copy link
Collaborator

lattner commented Jul 27, 2005

Bugzilla Link 609
Resolution FIXED
Resolved on Feb 22, 2010 12:51
Version 1.4
OS MacOS X

Extended Description

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

@lattner
Copy link
Collaborator Author

lattner commented Jul 27, 2005

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Jul 28, 2005

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

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm-tools All llvm tools that do not have corresponding tag miscompilation
Projects
None yet
Development

No branches or pull requests

1 participant