#724 Compiler Produces Invalid

closed-fixed
Erik Petrich
5
2013-05-25
2004-03-15
Anonymous
No

Greetings,

According to the 8051 manual, the MOV A,ACC
combination is invalid.

On my CPU (Phillips P89C51RD2HBA) when executed, it
results in "A" having 0xFF regardless of the original value
of ACC.

If any more information is needed, post to the user/dev
lists or storys@charter.net.

(I suppose flames can be accepted if i deserve them..)
Thanks,
-Lenny

SDCC VERSION :

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51
/ds400/hc08 2.3.6 (Dec 26 2003) (UNIX)

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51
/ds400/hc08 2.4.1 (Mar 15 2004) (UNIX)

I Tried this on two different versions, including the latest
from last night.

COMPILE LINE :

/raid/CVS/Embedded/Sdcc12252003/bin/sdcc --nogcse -
-nooverlay --noinvariant --noinduction --nojtbound --
noloopreverse --no-pee
p --nolabelopt --stack-auto --debug --model-large -
L/raid/CVS/Embedded/Sdcc12252003 ./src/movaacc.c

INCORRECT CODE :

The first argument is stored in registers, the next two
are generated by the genIpush routine, which incorrectly
encodes the "MOV A,ACC". As shown below :

; genIpush
mov dptr,#_pTArg3
movx a,@dptr
mov a,acc
push acc
inc dptr
movx a,@dptr
mov a,acc
push acc
inc dptr
movx a,@dptr
mov a,acc
push acc

REPRODUCABLE CODE :

char *pTArg1;
char *pTArg2;
char *pTArg3;

int Foo(char *arg1, char *arg2, char *arg3);

void main(void)
{
Foo(pTArg1, pTArg2, pTArg3);
}

int Foo(char *arg1, char *arg2, char *arg3)
{
arg1 = arg2;
arg2 = arg3;
}

Discussion

  • Erik Petrich
    Erik Petrich
    2004-03-19

    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • summary: Compiler Produces Invalid "MOV A,ACC" Instructions --> Compiler Produces Invalid
    • status: open --> closed-fixed
     
  • Erik Petrich
    Erik Petrich
    2004-03-19

    Logged In: YES
    user_id=635249

    This specific case, along with a few other is fixed in
    src/mcs51/gen.c 1.197