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/6c31c93fa5d3
branches:  trunk
changeset: 374657:6c31c93fa5d3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue May 09 15:37:29 2023 +0000

description:
tests/lint: demonstrate wrong warning about loss of accuracy

diffstat:

 tests/usr.bin/xlint/lint1/msg_132.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 8fdc91ad2c09 -r 6c31c93fa5d3 tests/usr.bin/xlint/lint1/msg_132.c
--- a/tests/usr.bin/xlint/lint1/msg_132.c       Tue May 09 15:02:59 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.c       Tue May 09 15:37:29 2023 +0000
@@ -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. */



Home | Main Index | Thread Index | Old Index