www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2967] New: spec does not mention that inline asm is a valid "return" statement.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2967

           Summary: spec does not mention that inline asm is a valid
                    "return" statement.
           Product: D
           Version: 1.043
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: tomas famolsen.dk


The spec on return mentions that:
"At least one return statement, throw statement, or assert(0) expression is
required if the function specifies a return type that is not void. "

However, in the inline asm docs the following example is there:

int foo(int x)
{
    asm
    {
    mov EAX,x[EBP]    ;  // loads value of parameter x into EAX
    mov EAX,x    ;  // does the same thing
    }
}


And DMD indeed allows inline asm to specify the return value, we've even had to
take the time to emulate this undocumented behaviour in LDC. It should be in
the spec, or there should be an assert(0) inserted after the inline asm!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2967


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



00:45:38 PST ---
Fixed dmd 1.053 and 2.037

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 06 2009