Skip to content

Commit 6df8cd2

Browse files
bonzinimdroth
authored andcommitted
atomic: fix position of volatile qualifier
What needs to be volatile is not the pointer, but the pointed-to value! Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 2cbcfb2) Signed-off-by: Michael Roth <[email protected]>
1 parent ff2fff6 commit 6df8cd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/qemu/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@
122122
#endif
123123

124124
#ifndef atomic_read
125-
#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
125+
#define atomic_read(ptr) (*(__typeof__(*ptr) volatile*) (ptr))
126126
#endif
127127

128128
#ifndef atomic_set
129-
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i))
129+
#define atomic_set(ptr, i) ((*(__typeof__(*ptr) volatile*) (ptr)) = (i))
130130
#endif
131131

132132
/* These have the same semantics as Java volatile variables.

0 commit comments

Comments
 (0)