#1062 invalid code generated for hc08

closed-fixed
hc08 port (43)
5
2013-05-25
2006-02-11
No

sdcc generates code with incorrect adressing mode for
the hc08 mcu.

1. sample
void main( void )
{
char status;
char stage;

status = 0;
while( status != 1 ) {
stage = 0;
status = 0;
while( status == 0 ) {
/*
do this and that ...
and of course the following:
*/
if(stage == 42) {
status = 1;
break;
}
stage++;
}
}
}

2. sdcc cmd
sdcc -mhc08 -c bug.c

3. sdcc -v
SDCC : hc08 2.5.4 #1203 (Feb 11 2006) (UNIX) from
today web snapshot page (src)
also
SDCC : pic16/hc08 0.0.0 #1185 (Dec 11 2005) (UNIX)
SDCC : pic16/hc08 2.5.0 #1020 (Jun 30 2005) (UNIX)
stable
any sdcc version compiled from source with everything
disabled but hc08 with
--disable-mcs51-port --disable-gbz80-port
--disable-z80-port --disable-avr-port
--disable-ds390-port --disable-pic-port
--disable-xa51-port --disable-ds400-port
--disable-ucsim --disable-pic16-port

4. error
?ASxxxx-Error-<a> in line 119 of bug.asm
<a> machine specific addressing or
addressing mode error

asm listing:
;bug.c:1: void main( void )
; -----------------------------------------
; function main
; -----------------------------------------
_main:
;bug.c:6: status = 0;
clra
sta _main_status_1_1
;bug.c:7: while( status != 1 ) {
00106$:
lda _main_status_1_1
cmp #0x01
; Peephole 2d - eliminated jmp
beq 00109$
00116$:
;bug.c:9: status = 0;
clra
sta _main_status_1_1
;bug.c:10: while( status == 0 ) {
clr *_main_sloc0_1_0
00103$:
tst #0x01 <- immediate mode not defined!
; Peephole 2d - eliminated jmp
beq 00106$
00117$:
;bug.c:15: if(stage == 42) {
lda *_main_sloc0_1_0
cmp #0x2A
; Peephole 2c - eliminated jmp
bne 00102$
00118$:
;bug.c:16: status = 1;
lda #0x01
sta _main_status_1_1
;bug.c:17: break;
; Peephole 3 - shortened jmp to bra
bra 00106$
00102$:
;bug.c:19: stage++;
inc *_main_sloc0_1_0
; Peephole 3 - shortened jmp to bra
bra 00103$
00109$:
rts

peep-hole optimization disabled only makes asm more
readable, but has no effect on error.

5. email
joerg.diederich@graffiti.net

Discussion

  • Erik Petrich

    Erik Petrich - 2006-05-10
    • assigned_to: nobody --> epetrich
     
  • Erik Petrich

    Erik Petrich - 2006-05-11
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Erik Petrich

    Erik Petrich - 2006-05-11

    Logged In: YES
    user_id=635249

    Fix in SDCC #4168

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks