www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1013] New: Invalid code generated for naked functions with (u)long arguments

reply d-bugmail puremagic.com writes:
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.


-- 
Feb 28 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1013






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.


-- 
Mar 05 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1013


dvdfrdmn users.sf.net changed:

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





Fixed in release 0.23


-- 
Mar 08 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1013






Thanks David, great work


-- 
Mar 10 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1013






Added to DStress as
http://dstress.kuehne.cn/run/a/asm_naked_01.d


-- 
Feb 25 2008