[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Dlang Bot changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #55 from Dlang Bot --- dlang/dmd pull request #10200 "Posix x64 ABI fixes 2" was merged into master: - 8a75689be02725741b2af939d63df432ab7c20f2 by سليمان السهمي (Suleyman Sahmi): Fix issues 5570, 13957 - Testsuite: enable asserts on tests https://github.com/dlang/dmd/pull/10200 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Walter Bright changed: What|Removed |Added Keywords||backend --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Ali Cehreli changed: What|Removed |Added CC||acehr...@yahoo.com --- Comment #54 from Ali Cehreli --- This may have fixed issue 6348 as well. --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Dlang Bot changed: What|Removed |Added Keywords||pull --- Comment #53 from Dlang Bot --- @SSoulaimane updated dlang/dmd pull request #10200 "Posix x64 ABI fixes 2" fixing this issue: - Fix issues 5570, 13957 - Testsuite: enable asserts on tests https://github.com/dlang/dmd/pull/10200 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Nicholas Wilson changed: What|Removed |Added CC||iamthewilsona...@hotmail.co ||m --- Comment #52 from Nicholas Wilson --- See https://github.com/dlang/dmd/pull/9013 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Issue 5570 depends on issue 9239, which changed state. Issue 9239 Summary: x86_64 ABI: 3 byte structs are never enregistered https://issues.dlang.org/show_bug.cgi?id=9239 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WORKSFORME --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 --- Comment #51 from Mike Franklin --- An potential additional $500 has been offered for a fix to this issue: https://forum.dlang.org/post/xlvstldxxehkqaxux...@forum.dlang.org --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Mike Franklin changed: What|Removed |Added CC||slavo5...@yahoo.com See Also|http://d.puremagic.com/issu | |es/show_bug.cgi?id=12343| --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Mike Franklin changed: What|Removed |Added See Also|http://d.puremagic.com/issu | |es/show_bug.cgi?id=6772 | --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Mike Franklin changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=19179 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Mike Franklin changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=13957 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Mike Franklin changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12343 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Timothee Courchanged: What|Removed |Added CC||timothee.co...@gmail.com --- Comment #50 from Timothee Cour --- is this still being worked on ? IIRC calypso handles return by value of C/C++ correctly (via llvm), maybe some of implementation can be reused? --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Walter Brightchanged: What|Removed |Added Keywords||C++ --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|D1 D2 |D2 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||yebbl...@gmail.com --- Comment #49 from yebblies yebbl...@gmail.com --- These other bug reports are part of this: Issue 13955 - 64 bit C ABI not followed for passing structs with mixed floating types Issue 13956 - 64 bit C ABI not followed for passing empty structs Issue 13957 - 64 bit C ABI not followed for passing structs with floating+integer types And issue 13955 and issue 13956 have been fixed in master. (In reply to Martin Nowak from comment #47) What's still left for this issue and why is there so much ABI dependent code in the frontend? Most of the remaining issues are in the code generator, and quite difficult to fix. --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added CC||and...@erdani.com --- Comment #48 from Andrei Alexandrescu and...@erdani.com --- From Walter's comment in the pull: Partial in that it doesn't solve the problem for returning structs of sizes 3,5-7,9-15 Finalizing this is necessary for getting all geared up for core.stdcpp. --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 --- Comment #47 from Martin Nowak c...@dawg.eu --- What's still left for this issue and why is there so much ABI dependent code in the frontend? --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://issues.dlang.org/show_bug.cgi?id=5570 Martin Nowak c...@dawg.eu changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12862 --
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #44 from Walter Bright bugzi...@digitalmars.com 2014-03-10 02:26:47 PDT --- Partial fix: https://github.com/D-Programming-Language/dmd/pull/3372 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #45 from Walter Bright bugzi...@digitalmars.com 2014-03-10 16:30:15 PDT --- Similar issue for Win64: http://d.puremagic.com/issues/show_bug.cgi?id=12343 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #46 from github-bugzi...@puremagic.com 2014-03-10 17:01:14 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f6b484366eb4b6c75056a5d6ce274c0fb2fa210a partial fix for Issue 5570 https://github.com/D-Programming-Language/dmd/commit/a707998a1286bd2a268b8dd3465373f582385e31 Merge pull request #3372 from WalterBright/fix5570 partial fix for Issue 5570 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://d.puremagic.com/issues/show_bug.cgi?id=5570 Etienne etci...@gmail.com changed: What|Removed |Added CC||etci...@gmail.com --- Comment #43 from Etienne etci...@gmail.com 2014-02-12 12:26:24 PST --- Could this be b/c struct size isn't calculated properly? ie. struct.c : ln 266 if (v-storage_class (STCstatic | STCextern | STCtls | STCgshared | STCmanifest | STCctfe | STCtemplateparameter)) return 0; where 0 = this member doesn't need further processing to determine struct size -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
https://d.puremagic.com/issues/show_bug.cgi?id=5570 cami...@bountysource.com changed: What|Removed |Added CC||cami...@bountysource.com --- Comment #42 from cami...@bountysource.com 2014-02-11 17:13:52 PST --- There is a $180 bounty on this issue: https://www.bountysource.com/issues/1325901. The bounty will get paid out to the developer who solves the issue. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #40 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-09-22 02:47:30 PDT --- (In reply to comment #39) This leads to a lot of duplication, for example the authors had to duplicate c bindings just to address this: https://github.com/Jebbs/DSFML-C where they point to this bug. I wonder if as a workaround you could type the prototypes in D as: // note the .tupleof sfWindow* sfWindow_create(VideoMode.tupleof mode, const(char)* title, uint style, const(ContextSettings)* settings); And then call it via: VideoMode vm; sfWindow_create(vm.tupleof, ...); I'd assume this would then properly use the stack? It's worth trying out to avoid any new code duplication, and then when 5570 is finally fixed all you have to do in user code is to remove .tupleof in the calls. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #41 from thelastmamm...@gmail.com 2013-09-22 20:07:53 PDT --- (In reply to comment #40) (In reply to comment #39) This leads to a lot of duplication, for example the authors had to duplicate c bindings just to address this: https://github.com/Jebbs/DSFML-C where they point to this bug. I wonder if as a workaround you could type the prototypes in D as: // note the .tupleof sfWindow* sfWindow_create(VideoMode.tupleof mode, const(char)* title, uint style, const(ContextSettings)* settings); corrected that to sfWindow_create(typeof(VideoMode.tupleof), ...) And then call it via: VideoMode vm; sfWindow_create(vm.tupleof, ...); still segfaults I'd assume this would then properly use the stack? It's worth trying out to avoid any new code duplication, and then when 5570 is finally fixed all you have to do in user code is to remove .tupleof in the calls. so far my (sad) woraround is to add a new C function that takes a pointer to the struct, and link against it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 thelastmamm...@gmail.com changed: What|Removed |Added CC||thelastmamm...@gmail.com --- Comment #39 from thelastmamm...@gmail.com 2013-09-21 19:48:09 PDT --- (In reply to comment #38) I don't think the three byte struct issue (see linked bug) has been fixed yet, but I haven't checked in a while. has not been fixed. was going to submit a bug report until I saw this thread. problem with: struct VideoMode{ uint width; uint height; uint bitsPerPixel; } sfWindow* sfWindow_create(sfVideoMode mode, const(char)* title, uint style, const(ContextSettings)* settings); This is used in SFML-D https://github.com/krzat/SFML-D, making it unsable on osx 64bit: the sample program crashes with auto screen = new RenderWindow(VideoMode(800, 600), Game, WindowStyle.Default, null); which I believe is caused by this. This leads to a lot of duplication, for example the authors had to duplicate c bindings just to address this: https://github.com/Jebbs/DSFML-C where they point to this bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #38 from David Nadlinger c...@klickverbot.at 2013-06-06 13:20:26 PDT --- I don't think the three byte struct issue (see linked bug) has been fixed yet, but I haven't checked in a while. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #36 from github-bugzi...@puremagic.com 2013-02-25 10:38:47 PST --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b2da13f39701796a6934e200f7c024305bd0c9e8 Merge pull request #1630 from Govelius/8fbb9279d51605d74824789d4954477b714bef52 64 bit ABI 16byte struct returns - Issue 5570 again -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #35 from github-bugzi...@puremagic.com 2013-02-23 15:10:03 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8fbb9279d51605d74824789d4954477b714bef52 64 bit ABI struct returns - Issue 5570 again https://github.com/D-Programming-Language/dmd/commit/a39da1070a5dbc84ecc1cd509ea85634ffdd7081 Merge pull request #1630 from Govelius/8fbb9279d51605d74824789d4954477b714bef52 64 bit ABI 16byte struct returns - Issue 5570 again -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Marco Leise marco.le...@gmx.de changed: What|Removed |Added CC||marco.le...@gmx.de --- Comment #34 from Marco Leise marco.le...@gmx.de 2013-02-06 03:59:36 PST --- Is this why my XCB calls on Linux fail? I already accused XCB people of writing incorrect tutorials until I realized that the exact same code does work in C. After probably two hours of trial and error to fix my code and reading articles on the web the word x86-64 showed up there and I had a dim memory of something not working in DMD 64-bit and C structs. So I tried GDC again, which I stopped because it produced another error somewhere else. There it works. The struct I try to get returned by a C library function looks like this: struct { void*, int, int } Most notably the int fields in my case should be 116 and 1, but are 0 and 0, while the pointer does have some value (not sure if the correct one as they change from executable to executable). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #33 from David Nadlinger c...@klickverbot.at 2012-12-29 18:04:07 PST --- I added issue 9239 as a blocker of this, as it also concerns the System V x86-64 ABI. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comment #32 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-10-22 12:47:53 PDT --- (In reply to comment #30) Progress at DMD1.075/2.060 beta2: This now works for structs which contain integral types only, or which contain floating point types only. It doesn't work if you have an int member and a float member. http://dpaste.dzfl.pl/f1ac00d2 Output is Test(5, 6, 5, 6) instead of Test(5, 6, 7, 8). It works OK if the function is extern(C). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Adrian Matoga e...@atari8.info changed: What|Removed |Added CC||e...@atari8.info --- Comment #31 from Adrian Matoga e...@atari8.info 2012-10-12 23:32:04 PDT --- *** Issue 8810 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #29 from Iain Buclaw ibuc...@ubuntu.com 2012-06-27 10:02:08 PDT --- (In reply to comment #27) (In reply to comment #26) (In reply to comment #25) Sigh – seems like I was not exactly right about how GDC and LDC are handling arrays. Instead of treating them like the equivalent struct, they are treated as if length and pointer were two separate arguments […] They are created as a two field struct in GDC. Oh well, apparently GDC handles dynamic arrays like structs in most cases, but as size_t/void* pairs for variadic arguments, ABI-wise – I discovered this behavior looking at the generated assembly while working on the LDC vararg ABI, and didn't expect formal arguments to be treated differently. Maybe the behavior should be unified? Yes, that is correct for dynamic arrays. :~) It does it on a condition that's pre-set as 'true' and can't be altered by the user. Of course, if all two field types in D (D arrays; delegates) should *always* be passed in the same way as two field struct should be, then I can turn it off (and add a switch to toggle it), or remove this code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #25 from klickverbot c...@klickverbot.at 2012-06-26 04:48:42 PDT --- Sigh – seems like I was not exactly right about how GDC and LDC are handling arrays. Instead of treating them like the equivalent struct, they are treated as if length and pointer were two separate arguments, with the important difference of course being that with the x86_64 ABI, structs are never only partly passed in registers (i.e., if there is only one register left, they would still pass the length in it and only push the pointer on the stack). The LDC x86_64 ABI implementation has had the following explanatory comment since it was originally written in 2009: This helps make things like printf(%.*s, o.toString()) work as expected; if we didn't do this that wouldn't work if there were 4 other integer/pointer arguments before the toString() call because the string got bumped to memory with one integer register still free. Changing the implementation to treat dynamic arrays/delegates the same as two-element structs for a potentially easier implementation of va_arg, etc. wouldn't be a problem, but we need to make a decision and, most importantly, properly document the expected behavior on dlang.org. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Iain Buclaw ibuc...@ubuntu.com changed: What|Removed |Added CC||ibuc...@ubuntu.com --- Comment #26 from Iain Buclaw ibuc...@ubuntu.com 2012-06-26 07:16:09 PDT --- (In reply to comment #25) Sigh – seems like I was not exactly right about how GDC and LDC are handling arrays. Instead of treating them like the equivalent struct, they are treated as if length and pointer were two separate arguments, with the important difference of course being that with the x86_64 ABI, structs are never only partly passed in registers (i.e., if there is only one register left, they would still pass the length in it and only push the pointer on the stack). They are created as a two field struct in GDC. eg, delegates (D arrays are a little above) https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/d-glue.cc#L3801 which calls: https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/d-codegen.cc#L1514 The LDC x86_64 ABI implementation has had the following explanatory comment since it was originally written in 2009: This helps make things like printf(%.*s, o.toString()) work as expected; if we didn't do this that wouldn't work if there were 4 other integer/pointer arguments before the toString() call because the string got bumped to memory with one integer register still free. %*.s works purely out of coincidence. You should not rely on it working at all - and if you are, you should really instead be fixing your program. Regards Iain -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #27 from klickverbot c...@klickverbot.at 2012-06-26 09:33:02 PDT --- (In reply to comment #26) (In reply to comment #25) Sigh – seems like I was not exactly right about how GDC and LDC are handling arrays. Instead of treating them like the equivalent struct, they are treated as if length and pointer were two separate arguments […] They are created as a two field struct in GDC. Oh well, apparently GDC handles dynamic arrays like structs in most cases, but as size_t/void* pairs for variadic arguments, ABI-wise – I discovered this behavior looking at the generated assembly while working on the LDC vararg ABI, and didn't expect formal arguments to be treated differently. Maybe the behavior should be unified? %*.s works purely out of coincidence. You should not rely on it working at all - and if you are, you should really instead be fixing your program. It does _not_ work only out of coincidence with LDC, as the ABI it is using was apparently explicitly designed by Frits to support this, judging from the comment I quoted before. It's platform-dependent, yes, but guaranteed to work – with GDC/LDC, that is, as this official ABI docs don't specify any details for passing array arguments. I suppose this was done to support code which assumes x86 behavior. In any case, I can't see much value in having it like this, and would certainly find just treating dynamic arrays as structs more natural. I just wanted to highlight that this needs to be discussed and probably documented. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #28 from Walter Bright bugzi...@digitalmars.com 2012-06-26 11:19:22 PDT --- My intention is to have the following all behave the same way: delegate struct S { void*, void* } void*[2] for parameter passing. The same goes for dynamic arrays. That means if you wrap a type in a struct, it will still pass the same way. The idea of making %.*s work with strings (without using .length and .ptr) has been deprecated for a long time, it isn't worth it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Fawzi Mohamed fa...@gmx.ch changed: What|Removed |Added CC||fa...@gmx.ch --- Comment #24 from Fawzi Mohamed fa...@gmx.ch 2012-06-25 05:03:48 PDT --- see Bug 8294, for something probably related with the work being done here... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #22 from klickverbot c...@klickverbot.at 2012-06-20 09:25:24 PDT --- (In reply to comment #21) When fixing the remaining issues, please also consider treating dynamic D arrays as »struct Array(T) { T* ptr; size_t length; }« on x86_64, i.e. passing them in two integer registers (if available). The fields of the struct should obviously have been swapped. In any case, this has been addressed in https://github.com/D-Programming-Language/dmd/commit/f50a339b86d9d2c141061d38f4f682211c3c07c3 and related commits – whether this was a coincidence or not, thanks a lot for the quick fix! --- Comment #23 from klickverbot c...@klickverbot.at 2012-06-20 09:25:25 PDT --- (In reply to comment #21) When fixing the remaining issues, please also consider treating dynamic D arrays as »struct Array(T) { T* ptr; size_t length; }« on x86_64, i.e. passing them in two integer registers (if available). The fields of the struct should obviously have been swapped. In any case, this has been addressed in https://github.com/D-Programming-Language/dmd/commit/f50a339b86d9d2c141061d38f4f682211c3c07c3 and related commits – whether this was a coincidence or not, thanks a lot for the quick fix! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #22 from klickverbot c...@klickverbot.at 2012-06-20 09:25:24 PDT --- (In reply to comment #21) When fixing the remaining issues, please also consider treating dynamic D arrays as »struct Array(T) { T* ptr; size_t length; }« on x86_64, i.e. passing them in two integer registers (if available). The fields of the struct should obviously have been swapped. In any case, this has been addressed in https://github.com/D-Programming-Language/dmd/commit/f50a339b86d9d2c141061d38f4f682211c3c07c3 and related commits – whether this was a coincidence or not, thanks a lot for the quick fix! --- Comment #23 from klickverbot c...@klickverbot.at 2012-06-20 09:25:25 PDT --- (In reply to comment #21) When fixing the remaining issues, please also consider treating dynamic D arrays as »struct Array(T) { T* ptr; size_t length; }« on x86_64, i.e. passing them in two integer registers (if available). The fields of the struct should obviously have been swapped. In any case, this has been addressed in https://github.com/D-Programming-Language/dmd/commit/f50a339b86d9d2c141061d38f4f682211c3c07c3 and related commits – whether this was a coincidence or not, thanks a lot for the quick fix! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 klickverbot c...@klickverbot.at changed: What|Removed |Added CC||c...@klickverbot.at --- Comment #21 from klickverbot c...@klickverbot.at 2012-06-17 14:50:19 PDT --- When fixing the remaining issues, please also consider treating dynamic D arrays as �struct Array(T) { T* ptr; size_t length; }� on x86_64, i.e. passing them in two integer registers (if available). This is what GDC and LDC are doing right now, since always passing them on the stack, like DMD does right now, would require quite a lot of extra effort in resp. additions to the respective backend code. There currently is a �pass on the stack for efficiency� comment in TypeDArray::toArgTypes(), but I can't quite see why this should be true in the general case, to be honest. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #19 from Leandro Lucarella leandro.lucare...@sociomantic.com 2012-05-31 04:29:21 PDT --- Just a simple example (I've used to see if the progress on the bug fixed some of the problems I had :): --- extern (C) { struct lldiv_t { long quot, rem; } lldiv_t lldiv(long numer, long denom); int printf(char* fmt, ...); } void main(char[][] args) { auto r = lldiv(94, 82); printf(%lld %lld\n, r.quot, r.rem); } --- For me, returns a high, randomish (changes on each run) number and 3 or 1. Examples: 20967488 3 32686144 3 38604832 1 20029472 1 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #20 from Walter Bright bugzi...@digitalmars.com 2012-05-31 12:39:49 PDT --- (In reply to comment #19) Just a simple example (I've used to see if the progress on the bug fixed some of the problems I had :): --- extern (C) { struct lldiv_t { long quot, rem; } The current state only fixes things that fit in one register. The lldiv_t is a two register struct. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Don clugd...@yahoo.com.au changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #18 from Don clugd...@yahoo.com.au 2012-05-23 01:18:18 PDT --- Another commit towards this issue: https://github.com/D-Programming-Language/dmd/commit/29eb972a2f329276a72a19e722671ff26bfe8534 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #15 from github-bugzi...@puremagic.com 2012-05-07 12:29:35 PDT --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/246f737c0f246f0b89ee27bfb611965e64f611ac start on fixing issue 5570 64 bit ABI --- Comment #16 from github-bugzi...@puremagic.com 2012-05-07 12:29:45 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f1039b341f2798f176dcf3c34019682d413ea863 start on fixing issue 5570 64 bit ABI -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #15 from github-bugzi...@puremagic.com 2012-05-07 12:29:35 PDT --- Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/246f737c0f246f0b89ee27bfb611965e64f611ac start on fixing issue 5570 64 bit ABI -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #17 from Johan Hernandez thepumpkin1...@gmail.com 2012-05-07 12:40:48 PDT --- I'm very happy to see some commits on this issue, this is really important!!! Walter++!!! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 James Miller ja...@aatch.net changed: What|Removed |Added CC||ja...@aatch.net --- Comment #14 from James Miller ja...@aatch.net 2012-05-03 01:13:16 PDT --- Throwing my vote in for this one, this is pretty much stopping me from using DMD64 for my C bindings. For the record, LDC works in this case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Johan Hernandez thepumpkin1...@gmail.com changed: What|Removed |Added CC||thepumpkin1...@gmail.com --- Comment #13 from Johan Hernandez thepumpkin1...@gmail.com 2012-04-25 11:19:32 PDT --- This is definitely a blocker, please fix this, this is a huge issue on OSX too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Leandro Lucarella leandro.lucare...@sociomantic.com changed: What|Removed |Added See Also||http://d.puremagic.com/issu ||es/show_bug.cgi?id=6772 --- Comment #12 from Leandro Lucarella leandro.lucare...@sociomantic.com 2012-04-16 03:27:08 PDT --- (In reply to comment #11) In general, something which has never worked is going to be treated as less of a priority than something which worked before and doesn't now - _especially_ when it's part of a newer feature. Yeah, and you know that something that worked before and doesn't work now is exactly what's called a *regression*, which have higher priority than *blocker*. So we all agree on that :) And this has _never_ worked correctly. And I don't know why you would think that a C ABI issue would be more important than an issue in D itself. As bad as this is, most D code is completely unaffected by this. It's only once you start dealing with C and structs that it matters. And that is a lot of codebase, you know? For example wxD, as Damian Ziemba pointed out can't work without this fixed. Also, and probably much less important than wxD, is making life at the company I work a little miserable trying to migrate to 64bit with this bug around. AFAIK Walter cares about big projects as wxD and making D usable for companies to consider this bug a blocker when it really blocks that kind of uses. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #10 from Mihail Strashun m.stras...@gmail.com 2012-04-11 04:23:31 PDT --- (In reply to comment #9) So, something which was in D itself (as opposed to how it talks with C code) which used to work but doesn't now could certainly be more of a blocker than this, My point exactly is that interfacing to C broken at ABI level is much more important than any inside language issue. Regressions are more important, yes, but, well, there is an importance level regression before blocker exactly for them. I'd say it is in the same category as wrong code generation for basic language constructs. It is something you rarely expect from even the new language when facing problems, something rather hard to identify and something almost any desktop D user is doomed to meet when try to build something usable ( as most usable programs tend to involve C bindings at this stage of std lib ). Issue a warning that it can happen when compiling extern(C) stuff of x64 at least. tl;dr : it is really bad for marketing -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #11 from Jonathan M Davis jmdavisp...@gmx.com 2012-04-11 09:51:04 PDT --- In general, something which has never worked is going to be treated as less of a priority than something which worked before and doesn't now - _especially_ when it's part of a newer feature. And this has _never_ worked correctly. And I don't know why you would think that a C ABI issue would be more important than an issue in D itself. As bad as this is, most D code is completely unaffected by this. It's only once you start dealing with C and structs that it matters. Now, why Walter hasn't this considered a high enough priority to fix it yet, I don't know. This is clearly a serious bug, and I would have thought that he would have made it a fairly high priority once he figured out that it was a problem, but for whatever reason, he hasn't. There are plenty of other high priority issues that he's been working on though - many of which have been around much longer than this. Still, one would hope that this wouldn't languish much longer. It's a major impedement to using 64-bit on D projects. By the way, for those that this is actually preventing from using 64-bit dmd and who really need it, gdc probably doesn't have this problem, since it relates to code generation. So, you could try that while waiting for Walter to get around to this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Mihail Strashun m.stras...@gmail.com changed: What|Removed |Added CC||m.stras...@gmail.com --- Comment #8 from Mihail Strashun m.stras...@gmail.com 2012-04-10 06:04:56 PDT --- If bug preventing almost any x64 D code interconnecting with C libs is not a blocker, I can hardly imagine what is. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #9 from Jonathan M Davis jmdavisp...@gmx.com 2012-04-10 10:11:53 PDT --- If bug preventing almost any x64 D code interconnecting with C libs is not a blocker, I can hardly imagine what is. I don't know how Walter decides that sort of thing or how he treats blockers. I believe that the worse that we normally see is critical. But this is something which has _never_ worked, and it's in a newer feature - 64-bit code generation - and it's something that not everyone is using. So, something which was in D itself (as opposed to how it talks with C code) which used to work but doesn't now could certainly be more of a blocker than this, depending on what it was. But in general, 64-bit specific stuff is less critical in that it only affects those using 64-bit rather than _everyone_ like many bugs do. I would actually expect Walter to consider this critical rather than a blocker. Certainly, if blocker indicates that something should block a release, this isn't it, since the bug has been around for as long as dmd's 64-bit code generation has been. But that's up to him. Regardless, this is a huge issue, and it should probably be treated as a higher priority than it has been, but much of what _has_ been being worked on is high priority stuff which affects much more D code than this does, so I suppose that it's not all that surprising that Walter hasn't gotten around to this yet. Still, I'd hope that this would be taken care of sooner rather than later. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Nick Sabalausky cbkbbej...@mailinator.com changed: What|Removed |Added CC||cbkbbej...@mailinator.com Severity|critical|blocker --- Comment #7 from Nick Sabalausky cbkbbej...@mailinator.com 2012-04-09 22:12:13 PDT --- So should we raise this to 'blocker'? I would argue yes since the *only* way to work around it if you can't modify the C side is to just not use 64-bit D. So it is a blocker for 64-bit D. (And AIUI, not all 64-bit systems are multilib, so even switching to 32 isn't always going to be an option.) Plus, there's...how many people *right here* have identified it as blocking them? Fuck, I'm just going to go ahead and raise it to blocker. If anyone has a problem with that they can change it back. Either way, the important thing is for this to get fixed, not to worry about its proper classification. So I don't know why I even wrote all this...Oh well... ;) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Trass3r mrmoc...@gmx.de changed: What|Removed |Added CC||mrmoc...@gmx.de --- Comment #5 from Trass3r mrmoc...@gmx.de 2012-02-01 17:08:14 CET --- So should we raise this to 'blocker'? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 siegelords_ab...@yahoo.com changed: What|Removed |Added CC||siegelords_ab...@yahoo.com --- Comment #4 from siegelords_ab...@yahoo.com 2011-12-17 11:49:28 PST --- See also http://d.puremagic.com/issues/show_bug.cgi?id=6348. It's plain impossible to use C libraries with value semantics for structs on 64 bits. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Leandro Lucarella llu...@gmail.com changed: What|Removed |Added Keywords||wrong-code CC||llu...@gmail.com Severity|normal |critical -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 --- Comment #1 from Leandro Lucarella llu...@gmail.com 2011-12-16 04:20:00 PST --- Any ETA for a fix? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Mathias Baumann mathias.baum...@sociomantic.com changed: What|Removed |Added CC||mathias.baumann@sociomantic ||.com --- Comment #2 from Mathias Baumann mathias.baum...@sociomantic.com 2011-12-16 06:13:08 PST --- This bug prevents us from switching to 64bit. We really would appreciate a fix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5570] 64 bit C ABI not followed for passing structs and complex numbers as function parameters
http://d.puremagic.com/issues/show_bug.cgi?id=5570 Damian Ziemba nazriel6...@gmail.com changed: What|Removed |Added CC||nazriel6...@gmail.com --- Comment #3 from Damian Ziemba nazriel6...@gmail.com 2011-12-16 06:45:46 PST --- Because of this bug, you can not use wxD with DMD64. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---