tests/lint: demonstrate wrong warning about loss of accuracy

This commit is contained in:
rillig 2023-05-09 15:37:29 +00:00
parent 3b53ecd493
commit b889b215f6
1 changed files with 10 additions and 1 deletions

View File

@ -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]
@ -368,6 +368,15 @@ test_ic_bitand(void)
u8 = u16 & u32;
}
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)
{