CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: mrg Date: Thu Aug 10 20:44:37 UTC 2023 Modified Files: src/tests/lib/libc/misc: Makefile Log Message: make this build with GCC 12. there are some odd constructs here to trigger sanitizers. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/misc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: mrg Date: Thu Aug 10 20:44:37 UTC 2023 Modified Files: src/tests/lib/libc/misc: Makefile Log Message: make this build with GCC 12. there are some odd constructs here to trigger sanitizers. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/misc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/misc/Makefile diff -u src/tests/lib/libc/misc/Makefile:1.8 src/tests/lib/libc/misc/Makefile:1.9 --- src/tests/lib/libc/misc/Makefile:1.8 Sun May 29 10:47:40 2022 +++ src/tests/lib/libc/misc/Makefile Thu Aug 10 20:44:37 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2022/05/29 10:47:40 andvar Exp $ +# $NetBSD: Makefile,v 1.9 2023/08/10 20:44:37 mrg Exp $ .include @@ -30,12 +30,11 @@ COPTS.t_ubsan.c += -Wno-stack-protector COPTS.t_ubsanxx.cpp += -Wno-stack-protector COPTS.ubsan.c+=${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :} -.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" COPTS.t_ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :} COPTS.t_ubsanxx.cpp+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-int-in-bool-context :} -.endif +COPTS.t_ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :} +COPTS.t_ubsanxx.cpp+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-uninitialized :} -# XXX -COPTS.ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-error=builtin-declaration-mismatch :} +COPTS.ubsan.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -Wno-builtin-declaration-mismatch :} .include
CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: joerg Date: Mon Oct 28 18:10:22 UTC 2019 Modified Files: src/tests/lib/libc/misc: t_ubsan.c Log Message: Avoid warnings about tautological left shifts as conditional. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/misc/t_ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/misc/t_ubsan.c diff -u src/tests/lib/libc/misc/t_ubsan.c:1.5 src/tests/lib/libc/misc/t_ubsan.c:1.6 --- src/tests/lib/libc/misc/t_ubsan.c:1.5 Wed Feb 20 11:40:41 2019 +++ src/tests/lib/libc/misc/t_ubsan.c Mon Oct 28 18:10:22 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ubsan.c,v 1.5 2019/02/20 11:40:41 kamil Exp $ */ +/* $NetBSD: t_ubsan.c,v 1.6 2019/10/28 18:10:22 joerg Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2018\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ubsan.c,v 1.5 2019/02/20 11:40:41 kamil Exp $"); +__RCSID("$NetBSD: t_ubsan.c,v 1.6 2019/10/28 18:10:22 joerg Exp $"); #include #include @@ -602,7 +602,7 @@ test_shift_out_of_bounds_signednessbit(v { volatile int32_t a = atoi("1"); - raise((a << 31) ? SIGSEGV : SIGBUS); + raise((a << 31) != 0 ? SIGSEGV : SIGBUS); } UBSAN_TC_BODY(shift_out_of_bounds_signednessbit, tc) @@ -626,7 +626,7 @@ test_shift_out_of_bounds_signedoverflow( volatile int32_t b = atoi("30"); a <<= b; - raise((a << 10) ? SIGSEGV : SIGBUS); + raise((a << 10) != 0 ? SIGSEGV : SIGBUS); } UBSAN_TC_BODY(shift_out_of_bounds_signedoverflow, tc) @@ -648,7 +648,7 @@ test_shift_out_of_bounds_negativeexponen volatile int32_t a = atoi("1"); volatile int32_t b = atoi("-10"); - raise((a << b) ? SIGSEGV : SIGBUS); + raise((a << b) != 0 ? SIGSEGV : SIGBUS); } UBSAN_TC_BODY(shift_out_of_bounds_negativeexponent, tc) @@ -670,7 +670,7 @@ test_shift_out_of_bounds_toolargeexponen volatile int32_t a = atoi("1"); volatile int32_t b = atoi("40"); - raise((a << b) ? SIGSEGV : SIGBUS); + raise((a << b) != 0 ? SIGSEGV : SIGBUS); } UBSAN_TC_BODY(shift_out_of_bounds_toolargeexponent, tc)
CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: joerg Date: Mon Oct 28 18:10:22 UTC 2019 Modified Files: src/tests/lib/libc/misc: t_ubsan.c Log Message: Avoid warnings about tautological left shifts as conditional. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/misc/t_ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: kamil Date: Thu Aug 15 08:17:32 UTC 2019 Modified Files: src/tests/lib/libc/misc: Makefile Log Message: Fix build of t_ubsan/t_ubsanxx under MKSANITIZER Do not link micro-ubsan runtime for disabled tests. This avoids double symbols linked into a single binary. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/misc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/lib/libc/misc
Module Name:src Committed By: kamil Date: Thu Aug 15 08:17:32 UTC 2019 Modified Files: src/tests/lib/libc/misc: Makefile Log Message: Fix build of t_ubsan/t_ubsanxx under MKSANITIZER Do not link micro-ubsan runtime for disabled tests. This avoids double symbols linked into a single binary. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/misc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/misc/Makefile diff -u src/tests/lib/libc/misc/Makefile:1.3 src/tests/lib/libc/misc/Makefile:1.4 --- src/tests/lib/libc/misc/Makefile:1.3 Mon Feb 4 03:10:33 2019 +++ src/tests/lib/libc/misc/Makefile Thu Aug 15 08:17:32 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2019/02/04 03:10:33 mrg Exp $ +# $NetBSD: Makefile,v 1.4 2019/08/15 08:17:32 kamil Exp $ .include @@ -8,13 +8,15 @@ TESTS_C+= t_ubsan TESTS_CXX+= t_ubsanxx .PATH: ${NETBSDSRCDIR}/common/lib/libc/misc -SRCS.t_ubsan= t_ubsan.c ubsan.c -SRCS.t_ubsanxx= t_ubsanxx.cpp ubsan.c +SRCS.t_ubsan= t_ubsan.c +SRCS.t_ubsanxx= t_ubsanxx.cpp .if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes" # These tests are designed to be used against micro-UBSan only. # micro-UBSan is used in these tests as a standalone libary only. CPPFLAGS+= -DENABLE_TESTS +SRCS.t_ubsan+= ubsan.c +SRCS.t_ubsanxx+= ubsan.c UBSAN_FLAGS= -fsanitize=undefined UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=integer :} UBSAN_FLAGS+= ${${ACTIVE_CC} == "clang" :? -fsanitize=nullability :}
Re: CVS commit: src/tests/lib/libc/misc
On 04.02.2019 09:50, Robert Elz wrote: > Date:Mon, 4 Feb 2019 05:02:46 +0100 > From:Kamil Rytarowski > Message-ID: <2eadaf71-d7d7-c285-bdec-78ddcd3a5...@gmx.com> > > > | If GCC is fine with it, we could try raise(!!(a * b) ? SIGSEGV : SIGBUS);= > > That's a kind of odd way of saying (a * b) != 0 ? ... > > kre > Yes, if it is acceptable for GCC, it's another option. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/tests/lib/libc/misc
Date:Mon, 4 Feb 2019 05:02:46 +0100 From:Kamil Rytarowski Message-ID: <2eadaf71-d7d7-c285-bdec-78ddcd3a5...@gmx.com> | If GCC is fine with it, we could try raise(!!(a * b) ? SIGSEGV : SIGBUS);= That's a kind of odd way of saying (a * b) != 0 ? ... kre
Re: CVS commit: src/tests/lib/libc/misc
On 04.02.2019 04:10, matthew green wrote: > Module Name: src > Committed By: mrg > Date: Mon Feb 4 03:10:33 UTC 2019 > > Modified Files: > src/tests/lib/libc/misc: Makefile t_ubsan.c > > Log Message: > - revert previous to t_ubsan.c, it is desired behaviour. from kamil. > - use -Wno-int-in-bool-context instead > > @@ -376,7 +376,7 @@ test_mul_overflow_signed(void) > volatile int a = INT_MAX; > volatile int b = atoi("2"); > > - raise((a && b) ? SIGSEGV : SIGBUS); > + raise((a * b) ? SIGSEGV : SIGBUS); If GCC is fine with it, we could try raise(!!(a * b) ? SIGSEGV : SIGBUS); It just matters to perform multiplication and overflow here. If it works, we can drop -Wno. > } > > UBSAN_TC_BODY(mul_overflow_signed, tc) > signature.asc Description: OpenPGP digital signature