Module Name: src
Committed By: rillig
Date: Fri Aug 19 19:13:04 UTC 2022
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_267.c
Log Message:
tests/lint: demonstrate wrong warning about bit-shift
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_267.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/msg_267.c
diff -u src/tests/usr.bin/xlint/lint1/msg_267.c:1.4 src/tests/usr.bin/xlint/lint1/msg_267.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_267.c:1.4 Thu Jun 16 21:24:41 2022
+++ src/tests/usr.bin/xlint/lint1/msg_267.c Fri Aug 19 19:13:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_267.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */
+/* $NetBSD: msg_267.c,v 1.5 2022/08/19 19:13:04 rillig Exp $ */
# 3 "msg_267.c"
// Test for message: shift equal to size of object [267]
@@ -16,3 +16,17 @@ shl32(unsigned int x)
/* expect+1: warning: shift equal to size of object [267] */
return x << 32;
}
+
+/*
+ * As of 2022-08-19, lint ignores the GCC-specific 'mode' attribute, treating
+ * the tetra-int as a plain single-int, thus having width 32.
+ *
+ * https://gcc.gnu.org/onlinedocs/gccint/Machine-Modes.html
+ */
+unsigned
+function(unsigned __attribute__((mode(TI))) arg)
+{
+ /* XXX: The 'size' usually means the size in bytes, not in bits. */
+ /* expect+1: warning: shift equal to size of object [267] */
+ return (arg >> 32) & 3;
+}