I somehow managed to make a small program with the bug. It appears to be a function call that creates the issue.
Code: Select all
bool func1(){
PlayTone( 2000, 1 );
return true;
}
task main(){
while( true ){
ClearScreen();
unsigned long time_0 = CurrentTick();
NumOut(0, LCD_LINE1, time_0 );
func1();
unsigned long time_1 = CurrentTick();
NumOut(0, LCD_LINE2, time_1 );
Wait( 50 );
}
}
time_0 works fine, however time_1 contains 1 which is func1()'s return value. The issue disappears if I change func1() to a void return type, however the original program used void functions.
muntoo, some NBC code for you: (of the example program)
Code: Select all
thread main
subcall __initialize_global_data, ____initialize_global_data_return
__NXC_Label_562:
set __D0main, 1
tst 5, __zfmain, __D0main
brtst 4, __NXC_Label_563, __zfmain
#pragma macro 6
mov __PointOutArgs.Location.X, __constVal200
mov __PointOutArgs.Location.Y, __constVal200
mov __PointOutArgs.Options, __constVal1
syscall 14, __PointOutArgs
gettick __main_7qG2_time_0_7qG2_001
set __signed_stack_001main, 0
set __signed_stack_002main, 56
mov __DU0main, __main_7qG2_time_0_7qG2_001
mov __TextOutArgs.Location.X, __signed_stack_001main
mov __TextOutArgs.Location.Y, __signed_stack_002main
set __TextOutArgs.Options, 0
numtostr __TextOutArgs.Text, __DU0main
syscall 13, __TextOutArgs
mov __D0main, __TextOutArgs.Result
subcall func1, __func1_return
mov __DU0main, __DU0func1
gettick __D0main
mov __main_7qG2_time_1_7qG2_001, __DU0main
set __signed_stack_001main, 0
set __signed_stack_002main, 48
mov __DU0main, __main_7qG2_time_1_7qG2_001
mov __TextOutArgs.Location.X, __signed_stack_001main
mov __TextOutArgs.Location.Y, __signed_stack_002main
set __TextOutArgs.Options, 0
numtostr __TextOutArgs.Text, __DU0main
syscall 13, __TextOutArgs
wait 50
jmp __NXC_Label_562
__NXC_Label_563:
exit -1, -1
endt