Problem with r226035 - in head/usr.bin/grep: . regex?
I noted the following after updating head to r226035: ... stage 4.4: building everything ... cc -O2 -pipe -Dxregcomp=regcomp -Dxre_exec=re_exec -Dxregexec=regexec -Dxre_search=re_search -Dxre_compile_fastmap=re_compile_fastmap -Dxregerror=regerror -Dxre_comp=re_comp -Dxre_set_syntax=re_set_syntax -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1 -I. -I/usr/src/gnu/usr.bin/gdb/libgdb/../arch/i386 -I/usr/src/gnu/usr.bin/gdb/libgdb/../../binutils/libbfd -I/usr/src/gnu/usr.bin/gdb/libgdb/../../binutils/libbfd/i386 -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/config -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/binutils/include -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/include -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/binutils/bfd -std=gnu99 -fstack-protector -c /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/tui/tui-source.c cc1: warnings being treated as errors /usr/src/usr.bin/grep/regex/tre-fastmatch.c: In function 'tre_match_fast': /usr/src/usr.bin/grep/regex/tre-fastmatch.c:961: warning: comparison of unsigned expression 0 is always false *** Error code 1 1 error *** Error code 2 1 error *** Error code 2 [I'm sorry, but I won't be in position to test fixes until after my laptop comes back from repair.] Peace, david -- David H. Wolfskill da...@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. pgpHLsIyOIDw3.pgp Description: PGP signature
Re: Problem with r226035 - in head/usr.bin/grep: . regex?
On 10/05/11 09:50, David Wolfskill wrote: I noted the following after updating head to r226035: ... stage 4.4: building everything ... cc -O2 -pipe -Dxregcomp=regcomp -Dxre_exec=re_exec -Dxregexec=regexec -Dxre_search=re_search -Dxre_compile_fastmap=re_compile_fastmap -Dxregerror=regerror -Dxre_comp=re_comp -Dxre_set_syntax=re_set_syntax -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1 -I. -I/usr/src/gnu/usr.bin/gdb/libgdb/../arch/i386 -I/usr/src/gnu/usr.bin/gdb/libgdb/../../binutils/libbfd -I/usr/src/gnu/usr.bin/gdb/libgdb/../../binutils/libbfd/i386 -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/config -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/binutils/include -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/include -I/usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/binutils/bfd -std=gnu99 -fstack-protector -c /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/tui/tui-source.c cc1: warnings being treated as errors /usr/src/usr.bin/grep/regex/tre-fastmatch.c: In function 'tre_match_fast': /usr/src/usr.bin/grep/regex/tre-fastmatch.c:961: warning: comparison of unsigned expression 0 is always false *** Error code 1 1 error *** Error code 2 [I'm sorry, but I won't be in position to test fixes until after my laptop comes back from repair.] Does this look right? *** src/usr.bin/grep/regex/tre-fastmatch.c~ Wed Oct 5 07:25:39 2011 --- src/usr.bin/grep/regex/tre-fastmatch.c Wed Oct 5 09:02:39 2011 *** *** 163,169 shift = bc; \ else \ { \ ! ts = ((long)u - v 0) ? 0 : (u - v); \ shift = MAX(ts, bc);\ shift = MAX(shift, gs); \ if (shift == gs)\ --- 163,169 shift = bc; \ else \ { \ ! ts = ((long)u - (long)v 0) ? 0 : (u - v); \ shift = MAX(ts, bc);\ shift = MAX(shift, gs); \ if (shift == gs)\ ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Problem with r226035 - in head/usr.bin/grep: . regex?
On 10/05/11 10:48, I wrote: Does this look right? ! ts = ((long)u - v 0) ? 0 : (u - v); \ Doh! It should probably be .. ts = ((long)(u - v) 0) ? 0 : (u - v); ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
Re: Problem with r226035 - in head/usr.bin/grep: . regex?
On Wed, 5 Oct 2011, Michael Butler wrote: On 10/05/11 10:48, I wrote: Does this look right? ! ts = ((long)u - v 0) ? 0 : (u - v); \ Doh! It should probably be .. ts = ((long)(u - v) 0) ? 0 : (u - v); This is definitely incorrect. Consider the case where u = (int)INT_MAX, v = (int)INT_MIN. Then (u-v) is evaluated within 'int' width, and overflows, causing undefined behavior (but probably wrapping), which is then cast to long. The cases where either u or v are unsigned types can also provide interesting edge cases. Probably the most correct choice is to cast all values to the widest supported signed integral type (since no type information is available within the macro scope), including the 'else' branch of the ternary operator, which is also susceptible to over/underflow. There are many style bugs with macros of this nature, on which bde would presumably be happy to expound. It seems that (at least in the first usage that I found) 'u' and 'v' are declared as unsigned int, so casting everything to signed long is unlikely to introduce breakage in the common case. -Ben Kaduk ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org