From: SourceForge.net <no...@so...> - 2006-05-19 14:19:23
|
Bugs item #1491627, was opened at 2006-05-19 14:19 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1491627&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: kosmonaut_pirx (kosmonaut_pirx) Assigned to: Nobody/Anonymous (nobody) Summary: variable bit shifting results in wrong code in hc08 port Initial Comment: 1. sample code char CTFLG; void main() { unsigned char bufno = 0; /* this is just to fool the optimizer */ if ( CTFLG ){ bufno = 1; } else{ bufno = 2; } CTFLG = 1 << bufno; } 2. sdcc command sdcc --no-peep -I. -I../include -mhc08 --stack-loc 0x044F --out-fmt-s19 --model-large --verbose -V --debug -c bug_bitshift.c 3. sdcc version SDCC : hc08 2.5.6 # (May 10 2006) (UNIX) also in an older version from snapshots: SDCC : hc08 2.5.4 #1219 (Mar 7 2006) (UNIX) compiled with only hc08 port: ./configure --disable-mcs51-port --disable-gbz80-port --disable-z80-port --disable-avr-port --disable-ds390-port --disable-pic-port --disable-pic16-port --disable-xa51-port --disable-ds400-port --disable-ucsim 4. error description The resulted code run into an infinite loop. The reason for this can be found at the appropriate lst-file and line: ;bug_bitshift.c:53: CTFLG = 1 << bufno; lda #0x01 sta _CTFLG lda _main_bufno_1_1 beq 00113$ 00112$: lda _CTFLG lsla sta _CTFLG deca bne 00112$ 00113$: The condition for bit shifting is not used in the last instructions anymore, so it just spins around forever. No idea for me at the moment about how to solve this instruction with just on register. 5. email joe...@gr... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1491627&group_id=599 |