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.

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.

If I'm wrong, please run the following commands and send a compressed copy of resulting width.i file.

cd gnulib-tests
gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -DIN_GREP_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../lib -I./../lib -I/usr/include/pcre -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -E -dD test-limits-h.c >width.i

You mentioned gcc-6.2.1. For what it's worth I didn't observe a problem on Fedora 24, which has gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2). A compressed copy of my width.i file is attached, for comparison. I built with "./configure --without-included-regex --disable-silent-rules CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables'".
#include <limits.h>
#include <stdio.h>

int
main (void)
{
  int n = sizeof (long);
  printf ("sizeof(long)=%d LONG_WIDTH=%d LONG_MIN=%ld LONG_MAX=%ld\n",
          n, LONG_WIDTH, LONG_MIN, LONG_MAX);
  return 0;
}

Attachment: width.i.gz
Description: application/gzip

Reply via email to