Bug 2967 – spec does not mention that inline asm is a valid "return" statement.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2009-05-12T12:41:00Z
Last change time
2014-04-18T09:15:27Z
Keywords
spec
Assigned to
nobody
Creator
tomas

Comments

Comment #0 by tomas — 2009-05-12T12:41:55Z
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 by bugzilla — 2009-12-06T00:45:38Z
Fixed dmd 1.053 and 2.037