Module Name:    src
Committed By:   rillig
Date:           Tue Mar 12 07:29:40 UTC 2024

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

Log Message:
tests/lint: demonstrate wrong warning when comparing a bit-field

Since decl.c 1.180 from 2021-05-02, which allowed arbitrary integer
types to be used as the underlying type for bit-fields in GCC mode.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/tests/usr.bin/xlint/lint1/msg_132.c:1.34
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.33	Sun Jan 28 08:17:27 2024
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Tue Mar 12 07:29:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.33 2024/01/28 08:17:27 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.34 2024/03/12 07:29:39 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -402,3 +402,19 @@ test_ic_conditional(char c1, char c2)
 	/* expect+1: warning: conversion from 'int' to 'unsigned char' may lose accuracy [132] */
 	u8 = cond ? s8 : u8;
 }
+
+void
+fp_classify(void)
+{
+	static struct ieee_ext {
+		unsigned long long ext_exp:15;
+	} x;
+
+	/* FIXME: There is no loss of accuracy here. */
+	/* expect+1: warning: conversion from 'unsigned long long:15' to 'int:15' may lose accuracy [132] */
+	if (x.ext_exp == 0) {
+	/* FIXME: There is no loss of accuracy here. */
+	/* expect+1: warning: conversion from 'unsigned long long:15' to 'int:15' may lose accuracy [132] */
+	} else if (x.ext_exp == 0x7fff) {
+	}
+}

Reply via email to