Module Name: src Committed By: rillig Date: Sun Jul 4 20:22:31 UTC 2021
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile Added Files: src/tests/usr.bin/xlint/lint1: op_shl_lp64.c op_shl_lp64.exp Log Message: test/lint: demonstrate wrong warnings for 128-bit shifts To generate a diff of this commit: cvs rdiff -u -r1.1075 -r1.1076 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.78 -r1.79 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/op_shl_lp64.c \ src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1075 src/distrib/sets/lists/tests/mi:1.1076 --- src/distrib/sets/lists/tests/mi:1.1075 Sun Jul 4 13:14:53 2021 +++ src/distrib/sets/lists/tests/mi Sun Jul 4 20:22:31 2021 @@ -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 Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.78 src/tests/usr.bin/xlint/lint1/Makefile:1.79 --- src/tests/usr.bin/xlint/lint1/Makefile:1.78 Sun Jul 4 13:14:54 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun Jul 4 20:22:31 2021 @@ -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.c 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 Added files: Index: src/tests/usr.bin/xlint/lint1/op_shl_lp64.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/op_shl_lp64.c:1.1 --- /dev/null Sun Jul 4 20:22:31 2021 +++ src/tests/usr.bin/xlint/lint1/op_shl_lp64.c Sun Jul 4 20:22:31 2021 @@ -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); Index: src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp:1.1 --- /dev/null Sun Jul 4 20:22:31 2021 +++ src/tests/usr.bin/xlint/lint1/op_shl_lp64.exp Sun Jul 4 20:22:31 2021 @@ -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]