[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
printf-safe checks of invalid long double values
From: |
Pádraig Brady |
Subject: |
printf-safe checks of invalid long double values |
Date: |
Thu, 27 Nov 2014 13:04:12 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
I noticed that vfprintf() was replaced on my glibc-2.20 system,
which is surprising and a lot of code to be duplicating.
This gets pulled in because:
$ grep gl_cv_func_printf.*=no config.log
gl_cv_func_printf_infinite_long_double=no
$ grep -A5 "checking.*infinite 'long double' arguments" config.log
configure:22775: checking whether printf supports infinite 'long double'
arguments
configure:23082: gcc -std=gnu99 -o conftest -march=native -g -O2 conftest.c
>&5
configure:23082: $? = 0
configure:23082: ./conftest
configure:23082: $? = 120
configure: program exited with status 120
Digging in a little with the attached conftest.c, all the failures
are due to the checking of pseudo infinity values. Now I've
no knowledge yet of floating point formats, but I'm surprised
that the replacement seems to give the same non NaN values that
the replaced system vfprintf outputs in this case:
$ printf '\x00\x00\x00\x00\x00\x00\x00\00\xFF\xFF\x00\x00\x00\x00\x00\x00' |
src/od -t fL
0000000 -0e+4912
Questions I have at present:
Are these checks backed up by corresponding replacement code?
Are these checks correct?
Why has glibc not been updated in the 7 years since the checks were added?
cheers,
Pádraig.
p.s. one can avoid these checks by unsetting gl_printf_safe
conftest.c
Description: Text document
- printf-safe checks of invalid long double values,
Pádraig Brady <=