This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nano printf + powerpc gcc


Sorry for my other email not replying to this, when I started writing it
I hadn't seen your email yet.

Anyhow, I suggested a change to your patch there at the end, if you
could give that a try to see if it works for you too, then we could (at
least for now) maybe get away with it.

Cheers,
Andre

On 24/01/18 16:02, Alexander Fedotov wrote:
> Hello Andre
> Yes indeed this fix unfortunately broke an ARM port. I have no idea
> why this builtins doesn't work on gcc for arm. Best way I believe
> right now is to revert this commit.
> 
> Alex
> 
> On Tue, Jan 23, 2018 at 5:04 PM, Andre Vieira (lists)
> <Andre.SimoesDiasVieira@arm.com> wrote:
>> Hi Alexander,
>>
>> This patch is causing our arm-none-eabi-gcc newlib-nano builds to fail.
>>
>> It seems the _Generic isn't picking up the right type when ap is of type
>> va_list. We get the following error:
>> newlib/libc/stdio/nano-vfscanf.c:430:2: error: cannot convert to a
>> pointer type
>> ret = _scanf_chars (rptr, &scan_data, fp, va_ptr(ap));
>> ^~~
>> newlib/libc/stdio/nano-vfscanf.c:432:2: error: cannot convert to a
>> pointer type
>> ret = _scanf_i (rptr, &scan_data, fp, va_ptr(ap));
>> ^~~
>> newlib/libc/stdio/nano-vfscanf.c:435:2: error: cannot convert to a
>> pointer type
>> ret = _scanf_float (rptr, &scan_data, fp, va_ptr(ap));
>>
>>
>> A reduced test-case, see:
>>
>> #include <stdio.h>
>> extern void bar(va_list *ap);
>> void foo(va_list ap) {
>>     bar(_Generic(&(ap), va_list *: &(ap), default: (va_list *)(ap)));
>> }
>>
>> Note that va_list for our toolchain is defined as gcc's __builtin_va_list.
>>
>> I have tried your other definitions of va_ptr too and none of them seem
>> to work. How do you suggest we proceed?
>>
>> Cheers,
>> Andre
>>
>>
>>
>> On 08/01/18 10:07, Corinna Vinschen wrote:
>>> 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
>>>
>>
> 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]