msg_306.c revision 1.3 1 /* $NetBSD: msg_306.c,v 1.3 2022/06/17 06:59:16 rillig Exp $ */
2 # 3 "msg_306.c"
3
4 // Test for message: constant truncated by conversion, op %s [306]
5
6 unsigned char
7 to_u8(void)
8 {
9 /* expect+1: warning: conversion of 'int' to 'unsigned char' is out of range [119] */
10 return 12345;
11 }
12
13 unsigned char
14 and_u8(unsigned char a)
15 {
16 /* XXX: unused bits in constant */
17 return a & 0x1234;
18 }
19
20 unsigned char
21 or_u8(unsigned char a)
22 {
23 /* expect+1: warning: constant truncated by conversion, op |= [306] */
24 a |= 0x1234;
25
26 /* XXX: Lint doesn't care about the expanded form of the same code. */
27 a = a | 0x1234;
28
29 return a;
30 }
31