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] |
Here is test case and expected output produced by host gcc: bash-4.3$ cat nano-sscanf-F-E-G.c && gcc nano-sscanf-F-E-G.c && ./a.out #include <stdio.h> float F = 0, E = 0, G = 0; int main() { char *in = "356.3e+2\n"; sscanf(in, "%F\n", &F); sscanf(in, "%E\n", &E); sscanf(in, "%G\n", &G); fprintf(stderr, ":%F: :%E: :%G:\n", F, E, G); return 0; } void __attribute__((noreturn)) exit(int code) { for (;;) asm volatile ("int $0x80" : : "a"(1), "b"(code)); } int write(int fd, char* buf, int size) { asm volatile ("int $0x80" : : "a"(4), "b"(fd), "c"(buf), "d"(size)); } void __attribute__((weak)) _start() { exit(main()); } :35630.000000: :3.563000E+04: :35630: Here is an output produced by newlib configured with --newlib-enable-nano-formatted-io knob: bash-4.3$ gcc -m32 nano-sscanf-F-E-G.c -I i386-elf/include/ -nostdlib i386-elf/lib/libc.a i386-elf/lib/libnosys.a -u _printf_float -u _scanf_float && ./a.out :F-07: :4.988623E-43: :4.98862E-43: Please find a patch in attachment Thanks, Igor
Attachment:
0001-newlib-libc-stdio-nano-vfscanf.c-Fix-F-G-and-E-speci.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |