1 void f00(int _Atomic dst);
2 void f01(int _Atomic *dst);
3 void f02(int _Atomic *dst);
4 void f03(int _Atomic *dst);
5
6 int _Atomic qo;
7 int uo;
8
9 void f00(int dst) { } /* check-should-pass */
10 void f01(typeof(&qo) dst) { } /* check-should-pass */
11 void f02(int *dst) { } /* check-should-fail */
12 void f03(typeof(&uo) dst) { } /* check-should-fail */
13
14 void foo(void)
15 {
16 qo = uo; /* check-should-pass */
17 uo = qo; /* check-should-pass */
18 }
19
20 void ref(void)
21 {
22 const int qo;
23 int uo;
24 extern const int *pqo;
25 extern int *puo;
26
27 pqo = &qo; /* check-should-pass */
28 pqo = &uo; /* check-should-pass */
29 pqo = puo;
30
31 puo = &uo; /* check-should-pass */
32
33 puo = &qo; /* check-should-fail */
34 puo = pqo; /* check-should-fail */
35 }
36
37 void bar(void)
38 {
39 extern int _Atomic *pqo;
40 extern int *puo;
41
42 pqo = &qo; /* check-should-pass */
43 pqo = &uo; /* check-should-pass */
44 pqo = puo;
45
46 puo = &uo; /* check-should-pass */
47
48 puo = &qo; /* check-should-fail */
49 puo = pqo; /* check-should-fail */
50 }
51
52 void baz(void)
53 {
54 extern typeof(&qo) pqo;
55 extern typeof(&uo) puo;
56
57 pqo = &qo; /* check-should-pass */
58 pqo = &uo; /* check-should-pass */
59 pqo = puo;
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
72 c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (originally declared at c11-atomic.c:3) - incompatible argument 1 (different modifiers)
73 c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (originally declared at c11-atomic.c:4) - incompatible argument 1 (different modifiers)
74 c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers)
75 c11-atomic.c:33:13: expected int *extern [assigned] puo
76 c11-atomic.c:33:13: got int const *
77 c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers)
78 c11-atomic.c:34:13: expected int *extern [assigned] puo
79 c11-atomic.c:34:13: got int const *extern [assigned] pqo
80 c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers)
81 c11-atomic.c:48:13: expected int *extern [assigned] puo
82 c11-atomic.c:48:13: got int [atomic] *
83 c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers)
84 c11-atomic.c:49:13: expected int *extern [assigned] puo
85 c11-atomic.c:49:13: got int [atomic] *extern [assigned] pqo
86 c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers)
87 c11-atomic.c:63:13: expected int *extern [assigned] puo
88 c11-atomic.c:63:13: got int [atomic] *
89 c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers)
90 c11-atomic.c:64:13: expected int *extern [assigned] puo
91 c11-atomic.c:64:13: got int [atomic] *extern [assigned] pqo
92 * check-error-end
93 */