Module Name:    src
Committed By:   rillig
Date:           Thu May 26 19:55:57 UTC 2022

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_132.c msg_132.exp

Log Message:
tests/lint: demonstrate wrong warnings about loss of accuracy


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_132.exp

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_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.11 src/tests/usr.bin/xlint/lint1/msg_132.c:1.12
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.11	Thu May 26 09:26:00 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Thu May 26 19:55:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.11 2022/05/26 09:26:00 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.12 2022/05/26 19:55:57 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -182,3 +182,16 @@ be32enc(void *buf, u32_t u)
 	p[2] = u >> 8 & 0xff;
 	p[3] = u & 0xff;
 }
+
+u32_t
+test_ic_shr(u64_t x)
+{
+	if (x > 3)
+		/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */
+		return x >> 32;
+	if (x > 2)
+		/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */
+		return x >> 31;
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132] */
+	return x;
+}

Index: src/tests/usr.bin/xlint/lint1/msg_132.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_132.exp:1.10 src/tests/usr.bin/xlint/lint1/msg_132.exp:1.11
--- src/tests/usr.bin/xlint/lint1/msg_132.exp:1.10	Thu May 26 09:26:00 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.exp	Thu May 26 19:55:57 2022
@@ -25,3 +25,6 @@ msg_132.c(99): warning: conversion from 
 msg_132.c(125): error: operands of '+' have incompatible types (pointer != double) [107]
 msg_132.c(125): warning: function 'cover_build_plus_minus' expects to return value [214]
 msg_132.c(141): warning: conversion from 'unsigned long long' to 'int' may lose accuracy [132]
+msg_132.c(191): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132]
+msg_132.c(194): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132]
+msg_132.c(196): warning: conversion from 'unsigned long long' to 'unsigned int' may lose accuracy [132]

Reply via email to