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/fc009dfce066
branches: trunk
changeset: 366440:fc009dfce066
user: rillig <rillig%NetBSD.org@localhost>
date: Thu May 26 19:55:57 2022 +0000
description:
tests/lint: demonstrate wrong warnings about loss of accuracy
diffstat:
tests/usr.bin/xlint/lint1/msg_132.c | 15 ++++++++++++++-
tests/usr.bin/xlint/lint1/msg_132.exp | 3 +++
2 files changed, 17 insertions(+), 1 deletions(-)
diffs (36 lines):
diff -r 608983769114 -r fc009dfce066 tests/usr.bin/xlint/lint1/msg_132.c
--- a/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 18:08:33 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.c Thu May 26 19:55:57 2022 +0000
@@ -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 @@
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;
+}
diff -r 608983769114 -r fc009dfce066 tests/usr.bin/xlint/lint1/msg_132.exp
--- a/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 18:08:33 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_132.exp Thu May 26 19:55:57 2022 +0000
@@ -25,3 +25,6 @@
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]
Home |
Main Index |
Thread Index |
Old Index