Missing sprintf for SH1 ?

J. Johnston jjohnstn@redhat.com
Fri Apr 11 15:14:00 GMT 2003

Are you including <stdio.h> in your test case?  Without it, the prototype
for sprintf() will be defaulted to take int arguments and return an int.
The sprintf() function in reality expects a variable argument list and you
need that noted in the prototype.

If you are specifying #include <stdio.h>, how did you configure and what
exactly did you specify to compile your test case?

-- Jeff J.

山田 淳 wrote:
> Hello.
> Although I am evaluating on CPU board of SH1 SH7034 of Hitachi, sprintf function does not operate correctly.
> buf after execution is still NULL.
> If an assembler is seen, the address is copied to buf, without the second parameter (fmt) going into a register 5 (r5) correctly.
> Why does it operate in this way?
> What should be changed into making it operate correctly?
> Please let me know someone.
> I ask of you.
> cygwin dll 1.3.15-2
> binutils 2.13.1
> gcc-core 2.95.3
> newlib 1.11.0 
> void    function( void ){
>     char    buf[30];    
>   char    *title = "test\r\n";
>     char    *fmt = "%s";
>     int     ret;    
>   memclr(buf,sizeof(buf));
>     ret = sprintf(buf, fmt, title); 
> }
> jun yamada

More information about the Newlib mailing list