On Wed, Oct 15, 2003 at 12:56:12PM -0300, Pedro Zorzenon Neto wrote:
> On Wed, Oct 15, 2003 at 07:29:13PM +0400, Dmitry wrote:
> > So, where is the bug?
> > In a source code? :)
> > ~d
>
> Hi Dmitry,
>
> The source code is:
>
> while ((* (int *) (++menu_stack[menu_i].item)) != NULL) ;
>
> However, the assembler code seems to do this:
>
> while (( (int *) (++menu_stack[menu_i].item)) != NULL) ;
>
> Am I right?
>
> Thanks,
> Pedro
An old version of mspgcc (maybe February 2003) generates this code:
.L3:
mov &menu_i, r15 ; 27 *movhi3/6 [length = 2]
rla r15 ; 30 *ashlhi3_1/1 [length = 1]
rla r15 ; 31 *ashlhi3_1/1 [length = 1]
add #menu_stack+2, r15 ; 32 *addhi3_3/8 [length = 2]
add #llo(12), @r15 ; 33 *addhi3_3/4 [length = 3]
mov @r15, r15 ; 34 *movhi3/6 [length = 1]
cmp #llo(0), @r15 ; 35 *cbranchhi [length = 3]
jne .L3
As you can see, this code has the "cmp" function.
The newest mspgcc version (updated 5 days ago) skips this "cmp" line.