Thanks for catching that. I installed the following patch: 2006-08-09 Paul Eggert <[EMAIL PROTECTED]>
* src/shuf.c (next_line): New function. (read_input): Use it, to avoid relying on GCC-specific behavior with void * arithmetic. Problem reported by Bob Proulx. * Makefile.maint (my-distcheck): Compile with -Wpointer-arith to detect this sort of problem automatically in the future. Index: src/shuf.c =================================================================== RCS file: /fetish/cu/src/shuf.c,v retrieving revision 1.1 diff -p -u -r1.1 shuf.c --- src/shuf.c 8 Aug 2006 22:22:48 -0000 1.1 +++ src/shuf.c 9 Aug 2006 18:07:04 -0000 @@ -129,6 +129,16 @@ input_from_argv (char **operand, int n_o operand[n_operands] = p; } +/* Return the start of the next line after LINE. The current line + ends in EOLBYTE, and is guaranteed to end before LINE + N. */ + +static char * +next_line (char *line, char eolbyte, size_t n) +{ + char *p = memchr (line, eolbyte, n); + return p + 1; +} + /* Read data from file IN. Input lines are delimited by EOLBYTE; silently append a trailing EOLBYTE if the file ends in some other byte. Store a pointer to the resulting array of lines into *PLINE. @@ -193,14 +203,14 @@ read_input (FILE *in, char eolbyte, char lim = buf + used; n_lines = 0; - for (p = buf; p < lim; p = memchr (p, eolbyte, lim - p) + 1) + for (p = buf; p < lim; p = next_line (p, eolbyte, lim - p)) n_lines++; *pline = line = xnmalloc (n_lines + 1, sizeof *line); line[0] = p = buf; for (i = 1; i <= n_lines; i++) - line[i] = p = memchr (p, eolbyte, lim - p) + 1; + line[i] = p = next_line (p, eolbyte, lim - p); errno = fread_errno; return n_lines; Index: Makefile.maint =================================================================== RCS file: /fetish/cu/Makefile.maint,v retrieving revision 1.238 diff -p -u -r1.238 Makefile.maint --- Makefile.maint 19 Jul 2006 08:43:27 -0000 1.238 +++ Makefile.maint 9 Aug 2006 18:07:04 -0000 @@ -450,7 +450,8 @@ null_AM_MAKEFLAGS = \ # Detect format-string/arg-list mismatches that would normally be obscured # by the use of _(). The --disable-nls effectively defines away that macro, # and building with CFLAGS='-Wformat -Werror' causes any format warning to be -# treated as a failure. Also, check for shadowing problems with -Wshadow. +# treated as a failure. Also, check for shadowing problems with -Wshadow, +# and for pointer arithmetic problems with -Wpointer-arith. # These CFLAGS are pretty strict. If you build this target, you probably # have to have a recent version of gcc and glibc headers. TMPDIR ?= /tmp @@ -461,7 +462,7 @@ my-distcheck: $(local-check) $(release_a GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz cd $(t)/$(distdir) \ && ./configure --disable-nls \ - && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow' \ + && $(MAKE) CFLAGS='-Werror -Wall -Wformat -Wshadow -Wpointer-arith' \ AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ && $(MAKE) dvi \ && $(MAKE) check \ _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils