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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
other: 0.702
graphic: 0.651
KVM: 0.647
permissions: 0.603
performance: 0.589
vnc: 0.582
semantic: 0.562
debug: 0.544
device: 0.513
socket: 0.467
boot: 0.457
PID: 0.447
files: 0.442
network: 0.437
error: argument 2 of ‘__atomic_load’ discards ‘const’ qualifier
GCC 11 reports the following errors:
[ 125s] In file included from /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/seqlock.h:17,
[ 125s] from /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/qht.h:10,
[ 125s] from /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:69:
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c: In function 'qht_do_lookup':
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:153:5: error: argument 2 of '__atomic_load' discards 'const' qualifier [-Werror=incompatible-pointer-types]
[ 125s] 153 | __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
[ 125s] | ^~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:161:5: note: in expansion of macro 'atomic_rcu_read__nocheck'
[ 125s] 161 | atomic_rcu_read__nocheck(ptr, &_val); \
[ 125s] | ^~~~~~~~~~~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:499:27: note: in expansion of macro 'atomic_rcu_read'
[ 125s] 499 | void *p = atomic_rcu_read(&b->pointers[i]);
[ 125s] | ^~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:153:5: error: argument 2 of '__atomic_load' discards 'const' qualifier [-Werror=incompatible-pointer-types]
[ 125s] 153 | __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
[ 125s] | ^~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:161:5: note: in expansion of macro 'atomic_rcu_read__nocheck'
[ 125s] 161 | atomic_rcu_read__nocheck(ptr, &_val); \
[ 125s] | ^~~~~~~~~~~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:506:13: note: in expansion of macro 'atomic_rcu_read'
[ 125s] 506 | b = atomic_rcu_read(&b->next);
[ 125s] | ^~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c: In function 'qht_lookup_custom':
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:153:5: error: argument 2 of '__atomic_load' discards 'const' qualifier [-Werror=incompatible-pointer-types]
[ 125s] 153 | __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
[ 125s] | ^~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:161:5: note: in expansion of macro 'atomic_rcu_read__nocheck'
[ 125s] 161 | atomic_rcu_read__nocheck(ptr, &_val); \
[ 125s] | ^~~~~~~~~~~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:534:11: note: in expansion of macro 'atomic_rcu_read'
[ 125s] 534 | map = atomic_rcu_read(&ht->map);
[ 125s] | ^~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c: In function 'qht_statistics_init':
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:153:5: error: argument 2 of '__atomic_load' discards 'const' qualifier [-Werror=incompatible-pointer-types]
[ 125s] 153 | __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
[ 125s] | ^~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:161:5: note: in expansion of macro 'atomic_rcu_read__nocheck'
[ 125s] 161 | atomic_rcu_read__nocheck(ptr, &_val); \
[ 125s] | ^~~~~~~~~~~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:907:11: note: in expansion of macro 'atomic_rcu_read'
[ 125s] 907 | map = atomic_rcu_read(&ht->map);
[ 125s] | ^~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:153:5: error: argument 2 of '__atomic_load' discards 'const' qualifier [-Werror=incompatible-pointer-types]
[ 125s] 153 | __atomic_load(ptr, valptr, __ATOMIC_RELAXED); \
[ 125s] | ^~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/include/qemu/atomic.h:161:5: note: in expansion of macro 'atomic_rcu_read__nocheck'
[ 125s] 161 | atomic_rcu_read__nocheck(ptr, &_val); \
[ 125s] | ^~~~~~~~~~~~~~~~~~~~~~~~
[ 125s] /home/abuild/rpmbuild/BUILD/qemu-5.0.0/util/qht.c:941:21: note: in expansion of macro 'atomic_rcu_read'
[ 125s] 941 | b = atomic_rcu_read(&b->next);
[ 125s] | ^~~~~~~~~~~~~~~
It looks like `typeof_strip_qual` doesn't work for pointer types.
Which means that given an argument of type T * const this defines a local variable that is also T * const, and then tries to store the result of the atomic load into that const variable:
```
#define atomic_rcu_read(ptr) \
({ \
typeof_strip_qual(*ptr) _val; \
atomic_rcu_read__nocheck(ptr, &_val); \
_val; \
})
```
GCC 11 correctly diagnoses that write to a const variable.
The QEMU project is currently moving its bug tracking to another system.
For this we need to know which bugs are still valid and which could be
closed already. Thus we are setting the bug state to "Incomplete" now.
If the bug has already been fixed in the latest upstream version of QEMU,
then please close this ticket as "Fix released".
If it is not fixed yet and you think that this bug report here is still
valid, then you have two options:
1) If you already have an account on gitlab.com, please open a new ticket
for this problem in our new tracker here:
https://gitlab.com/qemu-project/qemu/-/issues
and then close this ticket here on Launchpad (or let it expire auto-
matically after 60 days). Please mention the URL of this bug ticket on
Launchpad in the new ticket on GitLab.
2) If you don't have an account on gitlab.com and don't intend to get
one, but still would like to keep this ticket opened, then please switch
the state back to "New" within the next 60 days (otherwise it will get
closed as "Expired"). We will then eventually migrate the ticket auto-
matically to the new system (but you won't be the reporter of the bug
in the new system and thus won't get notified on changes anymore).
Thank you and sorry for the inconvenience.
[Expired for QEMU because there has been no activity for 60 days.]
|