Module Name:    src
Committed By:   rillig
Date:           Tue May  9 15:37:29 UTC 2023

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/msg_132.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_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.27 src/tests/usr.bin/xlint/lint1/msg_132.c:1.28
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.27	Tue May  9 14:46:36 2023
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Tue May  9 15:37:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.27 2023/05/09 14:46:36 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.28 2023/05/09 15:37:29 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -369,6 +369,15 @@ test_ic_bitand(void)
 }
 
 void
+test_ic_cvt(void)
+{
+	u16 = (u32 & 0x0000ff00);
+	/* FIXME: Don't throw away the constraint. */
+	/* expect+1: warning: conversion from 'unsigned int' to 'unsigned short' may lose accuracy [132] */
+	u16 = (u32_t)(u32 & 0x0000ff00);
+}
+
+void
 test_ic_conditional(char c1, char c2)
 {
 	/* Both operands are representable as char. */

Reply via email to