Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: demonstrate wrong warn...



details:   https://anonhg.NetBSD.org/src/rev/9627e420781c
branches:  trunk
changeset: 369467:9627e420781c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 19 19:13:04 2022 +0000

description:
tests/lint: demonstrate wrong warning about bit-shift

diffstat:

 tests/usr.bin/xlint/lint1/msg_267.c |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 35a7b3bbc33e -r 9627e420781c tests/usr.bin/xlint/lint1/msg_267.c
--- a/tests/usr.bin/xlint/lint1/msg_267.c       Fri Aug 19 15:55:36 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_267.c       Fri Aug 19 19:13:04 2022 +0000
@@ -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 @@
        /* 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;
+}



Home | Main Index | Thread Index | Old Index