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



--- Comment #2 from Don <clugd...@yahoo.com.au> 2011-09-05 00:23:54 PDT ---
(In reply to comment #1)
> In which case, what would "naked" do?  If nothing, the compiler ought to
> disallow it.

For non-naked functions, the contracts don't set up a stack frame, because the
function already does it. The generated code is:
 push EBP;
 mov EBP, ESP;
 <run in contract>
 <run function body>
 <run out contract>
 pop EBP;

If no contracts are present, or with -release, the generated code is currently:
 <run naked body>
which is correct.

But if contracts are present, and not in a release build, the code is:
 <run in contract>
 <run naked body>
 <run out contract>
which causes a crash. Correct behaviour would be:

 push EBP;
 mov EBP, ESP;
 <run in contract>
 pop EBP;
 <run naked body>
 push EBP;
 mov EBP, ESP;
 <run out contract>
 pop EBP;

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

Reply via email to