Thread overview
[Issue 1013] New: Invalid code generated for naked functions with (u)long arguments
Mar 01, 2007
d-bugmail
Mar 05, 2007
d-bugmail
Mar 09, 2007
d-bugmail
Mar 10, 2007
d-bugmail
Feb 25, 2008
d-bugmail
March 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1013

           Summary: Invalid code generated for naked functions with (u)long
                    arguments
           Product: DGCC aka GDC
           Version: unspecified
          Platform: PC
               URL: http://minah.aziz.am/Programming/d-naked-bug.html
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn@users.sf.net
        ReportedBy: madou@madou.org


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.


-- 

March 05, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1013





------- Comment #1 from madou@madou.org  2007-03-05 02:17 -------
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.


-- 

March 09, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1013


dvdfrdmn@users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from dvdfrdmn@users.sf.net  2007-03-08 20:19 -------
Fixed in release 0.23


-- 

March 10, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1013





------- Comment #3 from madou@madou.org  2007-03-10 16:21 -------
Thanks David, great work


-- 

February 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1013





------- Comment #4 from thomas-dloop@kuehne.cn  2008-02-25 05:02 -------
Added to DStress as http://dstress.kuehne.cn/run/a/asm_naked_01.d


--