Hynek Sladky schrieb:
> I have function for caseless compare:
> int strnicmp (const char *s1, const char *s2, int maxlen) {
> [...]
> ;     genIfx
>       ld      a,e             ;overwriting A!!!
>       or      a,d
>       jr      Z,00114$
> ;     genIfx
>       xor     a,a
>       or      a,c
>       jr      Z,00114$
> ;     genIfx
>       xor     a,a
>       or      a,b
>       jr      Z,00114$
> ;     genIfx
>       or      a,a             ;seems wants to use A???
>       jp      NZ,00112$
> 
> It seems that it wants to use previously computed result stored in A but 
> later this is overwritten. What to do to get correctly compiled program?
> 
> Thanks
> Hynek Sladky

I just tried with sdcc 2.8.9 #5392. I compiled your function using sdcc
-mz80 test.c. I could not reproduce the bug. I get the following code:

;test.c:10: } while (maxlen && c1 && c2 && c1==c2);
        ld      a,e
        or      a,d
        jr      Z,00114$
        xor     a,a
        or      a,c
        jr      Z,00114$
        xor     a,a
        or      a,b
        jr      Z,00114$
        xor     a,a
        or      a,-5 (ix)
        jp      NZ,00112$
00114$:

Philipp


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to