SourceForge has been redesigned. Learn more.
Close

#586 vprintf.c - compilation produces incorrect code

closed
nobody
5
2003-11-02
2003-09-17
Anonymous
No

SDCC :
mcs51/gbz80/z80/avr/ds390/pic14/pic16/TININative/xa51/ds400
2.3.5 (Aug 22 2003) (UNIX)

The standard library function printf() does not print
long variables correctly. Looking at the .asm file
produced by, say

sdcc -c --model-small vprintf.c

The assignments within the switch statement to the
static bit variables in vsprintf produce no code !

vprintf.c:
case 'B':
char_argument = 1;
goto get_conversion_spec;
case 'L':
long_argument = 1;
goto get_conversion_spec;

vprintf.asm:

;vprintf.c:380: char_argument = 1;
00123$:
; genAssign
;vprintf.c:381: goto get_conversion_spec;
ljmp 00104$
;vprintf.c:383: long_argument = 1;
00124$:
; genAssign
;vprintf.c:384: goto get_conversion_spec;
ljmp 00104$

Thus long and byte arguments are treated as int.
similarly, zero padding does not work .Declaring these
variables as 'bit' as opposed to 'static bit' produces
the correct behavior.

tony.hague@bbsrc.ac.uk

Discussion

  • Klaus Flittner

    Klaus Flittner - 2003-10-31

    Logged In: YES
    user_id=879538

    fixed in SDCCcse.c 1.86

     
  • Klaus Flittner

    Klaus Flittner - 2003-11-02
    • status: open --> closed
     

Log in to post a comment.