----- Original Message -----
> Thanks for reporting a problem. Please run the attached program width.c
> on your platform with your C compiler and the compiler flags you're
> using to build 'grep'. Although width.c should output "sizeof(long)=4
> LONG_WIDTH=32 LONG_MIN=-2147483648 LONG_MAX=2147483647", it appears from
> your build log
> <https://kojipkgs.fedoraproject.org/work/tasks/8044/15928044/build.log>
> that width.c will output "sizeof(long)=4 LONG_WIDTH=64
> LONG_MIN=-2147483648 LONG_MAX=2147483647", i.e., LONG_WIDTH will be wrong.
>
With 'gcc -D_GNU_SOURCE -o width width.c':
sizeof(long)=4 LONG_WIDTH=64 LONG_MIN=-2147483648 LONG_MAX=2147483647

> If I'm right, please investigate why LONG_WIDTH is wrong for your build
> configuration. The symptoms are that of a 32-bit build with a 64-bit C
> preprocessor, at least as far as __LONG_WIDTH__ is concerned. If this is
> a common-enough platform error then I suppose Gnulib should work around
> the implementation bug.
>
Yes LONG_WIDTH is 64 and it shouldn't be. I think the reason is the
following new code from the /usr/include/limits.h:

/* The integer width macros are not defined by GCC's <limits.h> before
   GCC 7, or if _GNU_SOURCE rather than
   __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature.  */
#if __GLIBC_USE (IEC_60559_BFP_EXT)
...
# if LONG_MAX == 0x7fffffffL
#  ifndef LONG_WIDTH
#   define LONG_WIDTH 32
#  endif
#  ifndef ULONG_WIDTH
#   define ULONG_WIDTH 32
#  endif
# else
#  ifndef LONG_WIDTH
#   define LONG_WIDTH 64
#  endif
#  ifndef ULONG_WIDTH
#   define ULONG_WIDTH 64
#  endif
# endif

but LONG_MAX is not defined in the check, it's defined later thus LONG_WIDTH is
incorrectly set to the 64 even on 32 bit platforms. I am going to open gcc bug

thanks & regards

Jaroslav



Reply via email to