www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2350] New: Contracts with a naked body are indecent

http://d.puremagic.com/issues/show_bug.cgi?id=2350

           Summary: Contracts with a naked body are indecent
           Product: D
           Version: 1.034
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au


It seems that in/out contracts assume that a stack frame has been set up. This
is not true for naked functions, so bad code is generated. Ideally, if the body
contains the keyword 'naked', in/out contracts should create and destroy a
stack frame.

----
void rude(int a)
in {
        assert(a==1);
}
body {
        asm { naked; }
}

void main() {
        rude(1);
}


-- 
Sep 09 2008