Module Name: src Committed By: rillig Date: Sun Mar 10 10:39:19 UTC 2024
Modified Files: src/tests/usr.bin/xlint/lint1: platform_lp64.c Log Message: tests/lint: enable test for integer overflow in array index To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/platform_lp64.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/usr.bin/xlint/lint1/platform_lp64.c diff -u src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.9 src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.10 --- src/tests/usr.bin/xlint/lint1/platform_lp64.c:1.9 Sat Mar 9 17:34:01 2024 +++ src/tests/usr.bin/xlint/lint1/platform_lp64.c Sun Mar 10 10:39:19 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: platform_lp64.c,v 1.9 2024/03/09 17:34:01 rillig Exp $ */ +/* $NetBSD: platform_lp64.c,v 1.10 2024/03/10 10:39:19 rillig Exp $ */ # 3 "platform_lp64.c" /* @@ -91,12 +91,15 @@ array_index(void) u64 += u64_buf[0x00ffffffffffffff]; /* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */ u64 += u64_buf[0x0fffffffffffffff]; - // FIXME: integer overflow - //u64 += u64_buf[0x1fffffffffffffff]; - // FIXME: integer overflow - //u64 += u64_buf[0x3fffffffffffffff]; - // FIXME: integer overflow - //u64 += u64_buf[0x7fffffffffffffff]; + /* expect+2: warning: operator '*' produces integer overflow [141] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x1fffffffffffffff]; + /* expect+2: warning: operator '*' produces integer overflow [141] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x3fffffffffffffff]; + /* expect+2: warning: operator '*' produces integer overflow [141] */ + /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + u64 += u64_buf[0x7fffffffffffffff]; /* expect+1: warning: array subscript cannot be negative: -1 [167] */ u64 += u64_buf[0xffffffffffffffff]; }