Code: Select all
not __DF0main, __DF0main
John Hansen
Code: Select all
not __DF0main, __DF0main
You are right.mrblp wrote:Hello,
I think this is the result of macro expansion. "until(x)" is defined as "while(!(x))". So at the end the statement is "while (!(1))". A real c compiler will make a "false" out of this but may be "nxc" is confused by that construction.
Give "while(0)" a try and tell us the result.
It's still frozen at optimize level 0.afanofosc wrote:There's definitely something going wrong - possibly a floating point type opcode incompatibility of some kind. Can you try with different optimization levels to see if it is an optimizer bug or a code generator bug? My guess is it is in the optimizer.
It's apart of a "real code". Actually, I found this problem after modified original code. The modification is delete the references of the variable y. It's working fine if add some code using the variable y like "OutText(0,0, NumToStr(y));".afanofosc wrote: Also, can you use the variables in the loop? They are being (partially) optimized out and that may lead to the bug you are seeing. Is there a "real code" case where this is hanging the brick or can you only replicate it in a trivial loop like you posted? For example, add code to write X and Y to the LCD using NumOut or something along those lines.
It's still frozen after checked all 2.0 and Enhanced and "automatic firmware".afanofosc wrote: I would encourage you to use the "automatic firmware" option if that is not already checked. That lets you check 2.0 and Enhanced but then it will automatically switch to standard if that is what you have installed on your NXT.
John Hansen
F12 code of util(1) at level 3afanofosc wrote: Can you show me the F12 code with until(1) and then show me the code with while(0) (which apparently works) for the current compiler at optimization level 3?
Code: Select all
dseg segment
;------- definitions -------
;------- declarations -------
__D0main sdword
__DF0main float
____initialize_global_data_return byte
__constVal1 sbyte 1
__PFTmp byte
dseg ends
;------- code -------
thread main
subcall __initialize_global_data, ____initialize_global_data_return
__ASM_Label_558:
not __DF0main, __constVal1
tst 5, __D0main, __DF0main
brtst 4, __ASM_Label_559, __D0main
jmp __ASM_Label_558
__ASM_Label_559:
exit -1, -1
endt
;------------------------
subroutine __initialize_global_data
subret ____initialize_global_data_return
ends
;------------------------
Code: Select all
dseg segment
;------- definitions -------
;------- declarations -------
__D0main sdword
____initialize_global_data_return byte
__constVal0 sbyte
__PFTmp byte
dseg ends
;------- code -------
thread main
subcall __initialize_global_data, ____initialize_global_data_return
__ASM_Label_558:
tst 5, __D0main, __constVal0
brtst 4, __ASM_Label_559, __D0main
jmp __ASM_Label_558
__ASM_Label_559:
exit -1, -1
endt
;------------------------
subroutine __initialize_global_data
subret ____initialize_global_data_return
ends
;------------------------
Code: Select all
not __DF0main, __constVal1
Code: Select all
static pSetOperand SetProcArray[9]= {cCmdSetByte, cCmdSetByte, cCmdSetByte, cCmdSetWord, cCmdSetWord, cCmdSetLong, cCmdSetLong, cCmdSetError, cCmdSetError}; // dup UByte to line up
Code: Select all
static pSetOperand SetProcArray[11]= {cCmdSetByte, cCmdSetByte, cCmdSetByte, cCmdSetWord, cCmdSetWord, cCmdSetLong, cCmdSetLong, cCmdSetError, cCmdSetError, cCmdSetError, cCmdSetFloat}; // dup UByte to line up
Thanks for your reply and I will try to using enhanced firmware.afanofosc wrote:This fix was never taken by LEGO and incorporated into the standard firmware. For this and many, many, many, many, many other reasons I highly recommend that you switch to using the enhanced firmware which is 100% compatible with the standard firmware but not broken like it is in several places.
Users browsing this forum: No registered users and 3 guests