nano printf + powerpc gcc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

nano printf + powerpc gcc

Alexander Fedotov
Hi

I'm experienced a strange printf() for float variables behaviour with
Nano version while regular is fine. It just prins out a garbage (even
with enabled -u _printf_float). After some digging I've managed to
track down issue until this line:

n = _printf_float (data, &prt_data, fp, pfunc, &ap);


Moreover there are number of warnings also in build log:

src_newlib/newlib/libc/stdio/nano-vfprintf.c -o lib_a-nano-svfprintf.o
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c: In
function '_svfprintf_r':
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:645:55:
warning: passing argument 5 of '_printf_float' from incompatible
pointer type
        n = _printf_float (data, &prt_data, fp, pfunc, &ap);
                                                                       ^
In file included from
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:169:0:
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf_local.h:228:1:
note: expected 'struct __va_list_tag (*)[1]' but argument is of type
'struct __va_list_tag **'
 _printf_float (struct _reent *data,
 ^
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:650:45:
warning: passing argument 5 of '_printf_i' from incompatible pointer
type
  n = _printf_i (data, &prt_data, fp, pfunc, &ap);
                                                            ^
In file included from
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:169:0:
../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf_local.h:221:1:
note: expected 'struct __va_list_tag (*)[1]' but argument is of type
'struct __va_list_tag **'
 _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,


It looks like nano written without taking in mind such targets. Here I
found workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557
that's working.

I'm attaching a patch.

Alex

0001-fix-incompatible-pointer-type-for-va_list-in-nano-ve.patch (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: nano printf + powerpc gcc

Corinna Vinschen
On Dec 25 16:39, Alexander Fedotov wrote:

> Hi
>
> I'm experienced a strange printf() for float variables behaviour with
> Nano version while regular is fine. It just prins out a garbage (even
> with enabled -u _printf_float). After some digging I've managed to
> track down issue until this line:
>
> n = _printf_float (data, &prt_data, fp, pfunc, &ap);
>
>
> Moreover there are number of warnings also in build log:
>
> src_newlib/newlib/libc/stdio/nano-vfprintf.c -o lib_a-nano-svfprintf.o
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c: In
> function '_svfprintf_r':
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:645:55:
> warning: passing argument 5 of '_printf_float' from incompatible
> pointer type
>         n = _printf_float (data, &prt_data, fp, pfunc, &ap);
>                                                                        ^
> In file included from
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:169:0:
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf_local.h:228:1:
> note: expected 'struct __va_list_tag (*)[1]' but argument is of type
> 'struct __va_list_tag **'
>  _printf_float (struct _reent *data,
>  ^
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:650:45:
> warning: passing argument 5 of '_printf_i' from incompatible pointer
> type
>   n = _printf_i (data, &prt_data, fp, pfunc, &ap);
>                                                             ^
> In file included from
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf.c:169:0:
> ../../../../../../src_newlib/newlib/libc/stdio/nano-vfprintf_local.h:221:1:
> note: expected 'struct __va_list_tag (*)[1]' but argument is of type
> 'struct __va_list_tag **'
>  _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
>
>
> It looks like nano written without taking in mind such targets. Here I
> found workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557
> that's working.
>
> I'm attaching a patch.
>
> Alex
Pushed.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer
Red Hat

signature.asc (849 bytes) Download Attachment