Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src test/lint: demonstrate wrong warnings for 128-bit shifts
details: https://anonhg.NetBSD.org/src/rev/456c55da6397
branches: trunk
changeset: 984361:456c55da6397
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 04 20:22:31 2021 +0000
description:
test/lint: demonstrate wrong warnings for 128-bit shifts
diffstat:
distrib/sets/lists/tests/mi | 4 +++-
tests/usr.bin/xlint/lint1/Makefile | 4 +++-
tests/usr.bin/xlint/lint1/op_shl_lp64.c | 18 ++++++++++++++++++
tests/usr.bin/xlint/lint1/op_shl_lp64.exp | 2 ++
4 files changed, 26 insertions(+), 2 deletions(-)
diffs (64 lines):
diff -r 6992b89fc82d -r 456c55da6397 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jul 04 17:32:24 2021 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jul 04 20:22:31 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1075 2021/07/04 13:14:53 rillig Exp $
+# $NetBSD: mi,v 1.1076 2021/07/04 20:22:31 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -6941,6 +6941,8 @@
./usr/tests/usr.bin/xlint/lint1/msg_345.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/op_colon.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/op_shl_lp64.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/stmt_for.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/stmt_for.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/t_integration tests-usr.bin-tests compattestfile,atf
diff -r 6992b89fc82d -r 456c55da6397 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile Sun Jul 04 17:32:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile Sun Jul 04 20:22:31 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.78 2021/07/04 13:14:54 rillig Exp $
+# $NetBSD: Makefile,v 1.79 2021/07/04 20:22:31 rillig Exp $
NOMAN= # defined
MAX_MESSAGE= 345 # see lint1/err.c
@@ -151,6 +151,8 @@
FILES+= msg_259_ilp32.exp
FILES+= op_colon.c
FILES+= op_colon.exp
+FILES+= op_shl_lp64.c
+FILES+= op_shl_lp64.exp
FILES+= stmt_for.c
FILES+= stmt_for.exp
diff -r 6992b89fc82d -r 456c55da6397 tests/usr.bin/xlint/lint1/op_shl_lp64.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/op_shl_lp64.c Sun Jul 04 20:22:31 2021 +0000
@@ -0,0 +1,18 @@
+/* $NetBSD: op_shl_lp64.c,v 1.1 2021/07/04 20:22:31 rillig Exp $ */
+# 3 "op_shl_lp64.c"
+
+/*
+ * Test overflow on shl of 128-bit integers, as seen in
+ * ecp_nistp256.c(296).
+ */
+
+/* lint1-only-if lp64 */
+
+const __uint128_t zero105 =
+ /* FIXME: 105 is ok for __uint128_t */
+ /* expect+1: warning: shift amount 105 is greater than bit-size 32 of 'int' [122] */
+ (((__uint128_t)1) << 105)
+ /* FIXME: 41 is ok for __uint128_t */
+ /* expect+1: warning: shift amount 41 is greater than bit-size 32 of 'int' [122] */
+ - (((__uint128_t)1) << 41)
+ - (((__uint128_t)1) << 9);
diff -r 6992b89fc82d -r 456c55da6397 tests/usr.bin/xlint/lint1/op_shl_lp64.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/op_shl_lp64.exp Sun Jul 04 20:22:31 2021 +0000
@@ -0,0 +1,2 @@
+op_shl_lp64.c(14): warning: shift amount 105 is greater than bit-size 32 of 'int' [122]
+op_shl_lp64.c(17): warning: shift amount 41 is greater than bit-size 32 of 'int' [122]
Home |
Main Index |
Thread Index |
Old Index