tests/lint: demonstrate wrong warning about losing accuracy

This commit is contained in:
rillig 2021-04-06 21:10:37 +00:00
parent f42f5ef49e
commit 483f849cbf
2 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg_132.c,v 1.3 2021/02/28 21:39:17 rillig Exp $ */
/* $NetBSD: msg_132.c,v 1.4 2021/04/06 21:10:37 rillig Exp $ */
# 3 "msg_132.c"
// Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@ -62,3 +62,10 @@ convert_signed(i8 v8, i16 v16, i32 v32, i64 v64)
v64 = v16;
v64 = v32;
}
_Bool
to_bool(long a, long b)
{
/* seen in fp_lib.h, function wideRightShiftWithSticky */
return a | b; /* expect: 132 *//*FIXME*/
}

View File

@ -10,3 +10,4 @@ msg_132.c(51): warning: conversion from 'long long' to 'signed char' may lose ac
msg_132.c(54): warning: conversion from 'int' to 'short' may lose accuracy [132]
msg_132.c(55): warning: conversion from 'long long' to 'short' may lose accuracy [132]
msg_132.c(59): warning: conversion from 'long long' to 'int' may lose accuracy [132]
msg_132.c(70): warning: conversion from 'long' to '_Bool' may lose accuracy [132]