blob: f82025bc1632399e2986122a5e31a3f03cc0b477 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* $NetBSD: lex_integer_ilp32.c,v 1.8 2023/03/28 14:44:34 rillig Exp $ */
# 3 "lex_integer_ilp32.c"
/*
* Tests for lexical analysis of integer constants.
*
* C99 6.4.4.1 "Integer constants"
*/
/* lint1-only-if: ilp32 */
/* lint1-extra-flags: -X 351 */
void sinki(int);
void sinku(unsigned int);
/* All platforms supported by lint have 32-bit int in two's complement. */
void
test_signed_int(void)
{
sinki(0);
sinki(-1);
sinki(2147483647);
/* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */
sinki(2147483648);
sinki(-2147483647);
/* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */
sinki(-2147483648);
}
void
test_unsigned_int(void)
{
sinku(0);
sinku(2147483647);
sinku(2147483648);
sinku(2147483648U);
sinku(4294967295U);
/* expect+1: warning: integer constant out of range [252] */
sinku(4294967296U);
}
|