-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Issue 13955 - 64 bit C ABI not followed for passing structs with mixed floating types #4265
Conversation
| @@ -429,7 +429,8 @@ TypeTuple *toArgTypes(Type *t) | |||
| { | |||
| if (t1->isfloating() && t2->isfloating()) | |||
| { | |||
| if (t1->ty == Tfloat64 && t2->ty == Tfloat64) | |||
| if ((t1->ty == Tfloat32 || t1->ty == Tfloat64) && | |||
| (t2->ty == Tfloat32 | t2->ty == Tfloat64)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the xor here is a typo, and it should instead be logical or.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bitwise or... I always get my or's mixed up. :)
…mixed floating types Check code in argtypes.c should be checking that both types can be passed in xmm registers.
|
Auto-merge toggled on |
Issue 13955 - 64 bit C ABI not followed for passing structs with mixed floating types
|
@yebblies: Did you find this using a fuzzer? Then I don't need to finish mine. ;) |
|
@klickverbot Yep, here it is: https://gist.github.com/yebblies/a848bd1326b380b471e8 @ibuclaw Thanks. |
|
@yebblies: Thanks, this will come in handy for me soon. |
…ng point numbers.
DMD is clearly wrong here for structs > 8 bytes and <= 16 bytes.
It passes the whole struct in memory if either exactly one field is a fp number
or if both fields are fp numbers and they are not both doubles.
The official docs (and Clang) don't have such a restriction. A simple struct
{ double a; int b; } is passed as if it were two separate arguments; a in a FP
register if available, b in a GP register if available.
This change probably leads to issues when trying to fetch such a struct passed
as vararg via va_arg; druntime (core.stdc.stdarg and core.vararg) would most
likely need to be fixed too.
Check code in argtypes.c should be checking that both types can be passed in xmm registers.
https://issues.dlang.org/show_bug.cgi?id=13955