Bug 1013 – Invalid code generated for naked functions with (u)long arguments

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-03-01T01:50:00Z
Last change time
2015-06-09T01:31:13Z
Keywords
wrong-code
Assigned to
dvdfrdmn
Creator
madou

Comments

Comment #0 by madou — 2007-03-01T01:50:32Z
On x86 systems, gdc creates nonsensical code at the beginning of naked functions taking long or ulong arguments. It reserves space on the stack, and copies any long arguments to that space, thus defeating assembler code that would work in any function without long arguments. See URL for an example.
Comment #1 by madou — 2007-03-05T02:17:55Z
The problem appears to be that the type information records for (u)long arguments call for 64bit alignment even on architectures that do not have 64bit memory access instructions (such as x86). I haven't had the chance to find out whether the gcc "tree" structures that contain the relevant data are being produced by gdc glue code, or whether they come from the gcc middle layer or backend. David? IMHO this should be fixed for non-naked functions as well, since copying around 64bit arguments even on architectures that do not benefit from 64bit alignment, creates useless overhead.
Comment #2 by dvdfrdmn — 2007-03-08T20:19:07Z
Fixed in release 0.23
Comment #3 by madou — 2007-03-10T16:21:32Z
Thanks David, great work
Comment #4 by thomas-dloop — 2008-02-25T05:02:44Z