Menu

#77 code after endproc should cause error

OnBoard_Asm
open
nobody
None
5
2005-04-16
2005-04-16
No

If you put code after an endproc, OnBA doesn't throw an
error, just generates bad code (as per message from
Jude):

"This is the mock function I tested on with beginproc
and endproc:

asm void test1(void) {
local x.w
beginproc
move.w #4,x(a6)
move.w x(a6),d0
cmp.w #4,d0
beq label1
move.w #5,d0
bra skip_else
label1
move.w #1,d0
skip_else
endproc
rts
}

When I disassembled it, I got this:

00D6 link a6,#-2
00DA move #4,-2(a6)
00E0 move -2(a6),d0
00E4 cmp #4,d0
00E8 beq $+6 ;00F0
00EA dc.w $F038 ;this is unexpected
00EC ori.b #4,d5 ;this is unexpected
00F0 move d6,d0 ;this is unexpected
00F2 ori.b #94,d6 ;this is unexpected
00F6 rts ;either this
00F8 rts ;or this is unexpected"

This appears to be due to OnBA outputing the debug
label and doing various other things when it encounters
an "endproc" directive. Best solution for this IMHO is to
report an error if we encounter code outside of a proc.

Discussion


Log in to post a comment.