This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Add more thorough generated tgmath.h test [committed]


On Wed, Jun 28, 2017 at 11:48 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jun 28, 2017 at 7:21 AM, Joseph Myers <joseph@codesourcery.com> wrote:
>> This patch adds a more thorough test of tgmath.h macros, verifying
>> both the return type and the function called for all the cases of
>> valid argument types.  (Cases with current problems - I've just filed
>> four bugs - are disabled or omitted pending fixing those problems.)
>> The test uses a Python generator (works with both Python 2 and 3) to
>> generate a C file which is then built and run as a test in the usual
>> way (and that C file includes its own dummy definitions of libm
>> functions similar to existing tgmath.h tests).  The motivation is to
>> make it easier to add tests of tgmath.h for _Float128 when adding
>> tgmath.h support for that type; the _FloatN / _FloatNx support is
>> present in the script, but disabled until the tgmath.h support is
>> written.
>>
>> Tested for x86_64, and for arm to check things in the long double =
>> double case.  (In that case, it's OK to call either double or long
>> double functions when the selected type is double or long double, as
>> long as the return type of the macro is exactly correct.)  Committed.
>>
>> 2017-06-28  Joseph Myers  <joseph@codesourcery.com>
>>
>>         * math/gen-tgmath-tests.py: New file.
>>         * math/Makefile [PYTHON] (tests): Add test-tgmath3.
>>         [PYTHON] (generated): Add test-tgmath3.c.
>>         [PYTHON] (CFLAGS-test-tgmath3.c): New variable.
>>         [PYTHON] ($(objpfx)test-tgmath3.c): New rule.
>>
>>
>
> With GCC 7.1.1 on i686, I got
>
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:130745:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:
> In function ‘conjf128’:
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:131030:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:
> In function ‘cprojf128’:
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:131315:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:
> In function ‘crealf128’:
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:131600:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:
> In function ‘roundevenf128’:
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:131885:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:
> In function ‘nextupf128’:
> /export/build/gnu/glibc-32bit-test/build-i686-linux/math/test-tgmath3.c:132104:21:
> error: ‘FLT128_MANT_DIG’ undeclared (first use in this function); did
> you mean ‘FLT_MANT_DIG’?
>    called_mant_dig = FLT128_MANT_DIG;
>                      ^~~~~~~~~~~~~~~
>                      FLT_MANT_DIG
>
>
> H.J.

GCC 7.1 float.h defines FLT128_MANT_DIG only if
__STDC_WANT_IEC_60559_TYPES_EXT__ is defined.  But include/float.h
has

#ifndef _ISOMAC
# define __STDC_WANT_IEC_60559_TYPES_EXT__
#endif

#include_next <float.h>

/* Supplement float.h macros for _Float128 for older compilers
   which do not yet support the type.  These are described in
   TS 18661-3.  */
#include <features.h>
#include <bits/floatn.h>
#if !__GNUC_PREREQ (7, 0) \
    && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define FLT128_MANT_DIG        113
# define FLT128_DECIMAL_DIG     36
# define FLT128_DIG             33
# define FLT128_MIN_EXP         (-16381)
# define FLT128_MIN_10_EXP      (-4931)
# define FLT128_MAX_EXP         16384
# define FLT128_MAX_10_EXP      4932
# define FLT128_MAX             1.18973149535723176508575932662800702e+4932Q
# define FLT128_EPSILON         1.92592994438723585305597794258492732e-34Q
# define FLT128_MIN             3.36210314311209350626267781732175260e-4932Q
# define FLT128_TRUE_MIN        6.47517511943802511092443895822764655e-4966Q
#endif

Since _ISOMAC is defined when compiling est-tgmath3.c, FLT128_MANT_DIG
won't be defined when GCC 7.1 is used.


-- 
H.J.


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