Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1052 branch error when using !!

closed-fixed
Bernhard Held
5
2013-05-25
2006-01-17
martin
No

The code:

-----------------------

sfr at 0x91 EXIF;

void main(void) {
while(!(!!(EXIF & 0x10)));
}

------------------------

generates the .asm file:

------------------------
...
_main:
ar2 = 0x02
ar3 = 0x03
ar4 = 0x04
ar5 = 0x05
ar6 = 0x06
ar7 = 0x07
ar0 = 0x00
ar1 = 0x01
;bug.c:5: while(!(!!(EXIF & 0x10)));
00101$:
; genAnd
mov a,_EXIF
; genIfxJump
; Peephole 108.e removed ljmp by inverse jump logic
jb acc.4,00101$
; Peephole 300 removed redundant label 00107$
; Peephole 300 removed redundant label 00104$
ret
.area CSEG (CODE)
.area CONST (CODE)
.area XINIT (CODE)

------------------------

The jb should be a jnb. If the code is changed to:

------------------------

sfr at 0x91 EXIF;

void main(void) {
while(!((EXIF & 0x10)));
}

------------------------

which should generate the same result the correct .asm
file is generated (with a jnb).

Compile line:
sdcc --iram-size 128 --xram-size 0x800 --code-size
0x8000 -c bug.c

Sdcc version used (I have tried 2.5.0 with the same
result):
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.4 #1191 (Jan 8 2006) (MINGW32)

Thanks!

Discussion

  • martin
    martin
    2006-01-17

    cool file

     
    Attachments
  • Bernhard Held
    Bernhard Held
    2006-01-17

    • labels: 355282 --> C-Front End
    • assigned_to: nobody --> bernhardheld
     
  • Bernhard Held
    Bernhard Held
    2006-01-17

    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Bernhard Held
    Bernhard Held
    2006-01-17

    Logged In: YES
    user_id=203539

    Fixed in SDCCast.c 1.268, sdcc build 1195