[Issue 2350] New: Contracts with a naked body are indecent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 9 00:50:06 PDT 2008


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 at digitalmars.com
        ReportedBy: clugdbug at 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);
}


-- 



More information about the Digitalmars-d-bugs mailing list