1void f00(int _Atomic  dst);
2void f01(int _Atomic *dst);
3void f02(int _Atomic *dst);
4void f03(int _Atomic *dst);
5
6int _Atomic qo;
7int         uo;
8
9void f00(int dst)	  { }	/* check-should-fail */
10void f01(typeof(&qo) dst) { }	/* check-should-pass */
11void f02(int *dst)	  { }	/* check-should-fail */
12void f03(typeof(&uo) dst) { }	/* check-should-fail */
13
14void foo(void)
15{
16	qo = uo;		/* check-should-pass */
17	uo = qo;		/* check-should-pass */
18}
19
20void ref(void)
21{
22	const int qo;
23	int uo;
24	const int *pqo;
25	      int *puo;
26
27	pqo = &qo;		/* check-should-pass */
28	pqo = &uo;		/* check-should-pass */
29	pqo = puo;		/* check-should-pass */
30
31	puo = &uo;		/* check-should-pass */
32
33	puo = &qo;		/* check-should-fail */
34	puo = pqo;		/* check-should-fail */
35}
36
37void bar(void)
38{
39	int _Atomic *pqo;
40	int         *puo;
41
42	pqo = &qo;		/* check-should-pass */
43	pqo = &uo;		/* check-should-fail */
44	pqo = puo;		/* check-should-fail */
45
46	puo = &uo;		/* check-should-pass */
47
48	puo = &qo;		/* check-should-fail */
49	puo = pqo;		/* check-should-fail */
50}
51
52void baz(void)
53{
54	typeof(&qo) pqo;
55	typeof(&uo) puo;
56
57	pqo = &qo;		/* check-should-pass */
58	pqo = &uo;		/* check-should-fail*/
59	pqo = puo;		/* check-should-fail */
60
61	puo = &uo;		/* check-should-pass */
62
63	puo = &qo;		/* check-should-fail */
64	puo = pqo;		/* check-should-fail */
65}
66
67/*
68 * check-name: C11 _Atomic type qualifier
69 * check-command: sparse -Wno-decl $file
70 *
71 * check-error-start
72c11-atomic.c:9:6: error: symbol 'f00' redeclared with different type (incompatible argument 1 (different modifiers)):
73c11-atomic.c:9:6:    void extern [addressable] [toplevel] f00( ... )
74c11-atomic.c:1:6: note: previously declared as:
75c11-atomic.c:1:6:    void extern [addressable] [toplevel] f00( ... )
76c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (incompatible argument 1 (different modifiers)):
77c11-atomic.c:11:6:    void extern [addressable] [toplevel] f02( ... )
78c11-atomic.c:3:6: note: previously declared as:
79c11-atomic.c:3:6:    void extern [addressable] [toplevel] f02( ... )
80c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (incompatible argument 1 (different modifiers)):
81c11-atomic.c:12:6:    void extern [addressable] [toplevel] f03( ... )
82c11-atomic.c:4:6: note: previously declared as:
83c11-atomic.c:4:6:    void extern [addressable] [toplevel] f03( ... )
84c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers)
85c11-atomic.c:33:13:    expected int *[assigned] puo
86c11-atomic.c:33:13:    got int const *
87c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers)
88c11-atomic.c:34:13:    expected int *[assigned] puo
89c11-atomic.c:34:13:    got int const *[assigned] pqo
90c11-atomic.c:43:13: warning: incorrect type in assignment (different modifiers)
91c11-atomic.c:43:13:    expected int [atomic] *[assigned] pqo
92c11-atomic.c:43:13:    got int *
93c11-atomic.c:44:13: warning: incorrect type in assignment (different modifiers)
94c11-atomic.c:44:13:    expected int [atomic] *[assigned] pqo
95c11-atomic.c:44:13:    got int *puo
96c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers)
97c11-atomic.c:48:13:    expected int *[assigned] puo
98c11-atomic.c:48:13:    got int [atomic] *
99c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers)
100c11-atomic.c:49:13:    expected int *[assigned] puo
101c11-atomic.c:49:13:    got int [atomic] *[assigned] pqo
102c11-atomic.c:58:13: warning: incorrect type in assignment (different modifiers)
103c11-atomic.c:58:13:    expected int [atomic] *[assigned] pqo
104c11-atomic.c:58:13:    got int *
105c11-atomic.c:59:13: warning: incorrect type in assignment (different modifiers)
106c11-atomic.c:59:13:    expected int [atomic] *[assigned] pqo
107c11-atomic.c:59:13:    got int *puo
108c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers)
109c11-atomic.c:63:13:    expected int *[assigned] puo
110c11-atomic.c:63:13:    got int [atomic] *
111c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers)
112c11-atomic.c:64:13:    expected int *[assigned] puo
113c11-atomic.c:64:13:    got int [atomic] *[assigned] pqo
114 * check-error-end
115 */
116