D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2967 - spec does not mention that inline asm is a valid "return" statement.
Summary: spec does not mention that inline asm is a valid "return" statement.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: spec
Depends on:
Blocks:
 
Reported: 2009-05-12 12:41 UTC by Tomas Lindquist Olsen
Modified: 2014-04-18 09:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tomas Lindquist Olsen 2009-05-12 12:41:55 UTC
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!
Comment 1 Walter Bright 2009-12-06 00:45:38 UTC
Fixed dmd 1.053 and 2.037