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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* $NetBSD: d_c99_complex_split.c,v 1.13 2023/03/28 14:44:34 rillig Exp $ */
# 3 "d_c99_complex_split.c"
/*
* Checks that the real and imaginary parts of a complex number can be
* accessed (since C99).
*/
/* lint1-extra-flags: -X 351 */
int
b(double a)
{
return a == 0;
}
void
a(void)
{
double _Complex z = 0;
if (b(__real__ z) && b(__imag__ z))
return;
}
void sink(double _Complex);
/*
* Before tree.c 1.275 from 2021-04-09, lint wrongly warned that when
* '__real__ c' was assigned, 'c may be used before set'.
*
* As of 2021-04-09, support for _Complex is still very incomplete, see
* build_real_imag for details. For example, lint does not know that after
* the assignment to '__real__ c', the variable is partially initialized.
*/
void
set_complex_complete(double re, double im)
{
double _Complex c;
__real__ c = re;
__imag__ c = im;
sink(c);
}
/*
* Before tree.c 1.275 from 2021-04-09, lint wrongly warned that when
* '__real__ c' was assigned, 'c may be used before set [158]'.
*
* As of 2021-04-09, support for _Complex is still very incomplete, see
* build_real_imag for details.
*/
void
set_complex_only_real(double re)
{
double _Complex c;
__real__ c = re;
/* __imag__ c is left uninitialized */
sink(c); /* XXX: may be used before set */
}
/*
* Before tree.c 1.275 from 2021-04-09, lint wrongly warned that when
* '__imag__ c' was assigned, 'c may be used before set [158]'.
*
* As of 2021-04-09, support for _Complex is still very incomplete, see
* build_real_imag for details.
*/
void
set_complex_only_imag(double im)
{
double _Complex c;
/* __real__ c is left uninitialized */
__imag__ c = im;
sink(c); /* XXX: may be used before set */
}
void
precedence_cast_expression(void)
{
double _Complex z = 0;
if (b(__real__(double _Complex)z) && b(__imag__(double _Complex)z))
return;
if (b(__real__(z)) && b(__imag__(z)))
return;
}
|