Date: Sun, 24 Nov 2019 13:14:58 -0800 From: Conrad Meyer <cem@freebsd.org> To: Li-Wen Hsu <lwhsu@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org> Subject: Re: svn commit: r355055 - head/tests/sys/sys Message-ID: <CAG6CVpWcqih_KzJ%2BiAP3GN9vZXUySKztEpiWuSHattgXWfumMQ@mail.gmail.com> In-Reply-To: <201911241503.xAOF3Zqd042071@repo.freebsd.org> References: <201911241503.xAOF3Zqd042071@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Don't we already build with -fwrapv for this class of problem? The GCC docs claim that warning is only active when signed overflow is undefined. It seems that -fno-strict-overflow has similar semantics to -fwrapv, but we should probably be consistent about the flag we use. Also, if GCC is producing this warning, I think Clang needs the same flag. Best, Conrad On Sun, Nov 24, 2019 at 7:03 AM Li-Wen Hsu <lwhsu@freebsd.org> wrote: > > Author: lwhsu > Date: Sun Nov 24 15:03:35 2019 > New Revision: 355055 > URL: https://svnweb.freebsd.org/changeset/base/355055 > > Log: > Fix gcc build > > We have -Werror=strict-overflow so gcc complains: > > In file included from /tmp/obj/workspace/src/amd64.amd64/tmp/usr/include/bitstring.h:36:0, > from /workspace/src/tests/sys/sys/bitstring_test.c:34: > /workspace/src/tests/sys/sys/bitstring_test.c: In function 'bit_ffc_at_test': > /workspace/src/sys/sys/bitstring.h:239:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow] > if (_start >= _nbits) { > ^ > > Disable assuming overflow of signed integer will never happen by specifying > -fno-strict-overflow > > Sponsored by: The FreeBSD Foundation > > Modified: > head/tests/sys/sys/Makefile > > Modified: head/tests/sys/sys/Makefile > ============================================================================== > --- head/tests/sys/sys/Makefile Sun Nov 24 13:53:36 2019 (r355054) > +++ head/tests/sys/sys/Makefile Sun Nov 24 15:03:35 2019 (r355055) > @@ -1,9 +1,15 @@ > # $FreeBSD$ > > +.include <bsd.compiler.mk> > + > TESTSDIR= ${TESTSBASE}/sys/sys > > ATF_TESTS_C= arb_test bitstring_test qmath_test rb_test splay_test > > WARNS?= 5 > + > +.if ${COMPILER_TYPE} == "gcc" > +CFLAGS.bitstring_test= -fno-strict-overflow > +.endif > > .include <bsd.test.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWcqih_KzJ%2BiAP3GN9vZXUySKztEpiWuSHattgXWfumMQ>