Module Name: src
Committed By: rillig
Date: Sun Aug 18 15:11:43 UTC 2024
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_132.c
Log Message:
tests/lint: demonstrate wrong warning about accuracy loss
Demonstrates PR toolchain/58617.
To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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.40 src/tests/usr.bin/xlint/lint1/msg_132.c:1.41
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.40 Wed May 1 05:49:33 2024
+++ src/tests/usr.bin/xlint/lint1/msg_132.c Sun Aug 18 15:11:43 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_132.c,v 1.40 2024/05/01 05:49:33 rillig Exp $ */
+/* $NetBSD: msg_132.c,v 1.41 2024/08/18 15:11:43 rillig Exp $ */
# 3 "msg_132.c"
// Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -454,3 +454,10 @@ binary_operators_on_bit_fields(void)
// warning: conversion of 'int' to 'int:4' is out of range [119]
s32 = 8 - bits.u3;
}
+
+unsigned char
+combine_arithmetic_and_bit_operations(unsigned int c32)
+{
+ /* expect+1: warning: conversion from 'unsigned int' to 'unsigned char' may lose accuracy [132] */
+ return 0xc0 | (c32 & 0x07c0) / 64;
+}