From 5faead30d83189536ab1cf3ea0f8940239cc9838 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Sat, 7 Apr 2018 18:27:14 -0700 Subject: [PATCH] Remove overzeleous assertions in pg_atomic_flag code. The atomics code asserts proper alignment in various places. That's mainly because the alignment of 64bit integers is not sufficient for atomic operations on all platforms. Some ABIs only have four byte alignment, but don't have atomic behavior when crossing page boundaries. The flags code isn't affected by that however, as the type alignment always is sufficient for atomic operations. Nevertheless the code asserted alignment requirements. Before 8c3debbb it was only broken on hppa, after it probably affect further platforms. Thus remove the assertions for pg_atomic_flag operators. Per buildfarm animal pademelon. Discussion: https://postgr.es/m/7223.1523124425@sss.pgh.pa.us Backpatch: 9.5- --- src/include/port/atomics.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h index 4e15ff8764..b955c73bb0 100644 --- a/src/include/port/atomics.h +++ b/src/include/port/atomics.h @@ -173,8 +173,6 @@ static inline void pg_atomic_init_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - pg_atomic_init_flag_impl(ptr); } @@ -188,8 +186,6 @@ pg_atomic_init_flag(volatile pg_atomic_flag *ptr) static inline bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - return pg_atomic_test_set_flag_impl(ptr); } @@ -203,8 +199,6 @@ pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) static inline bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - return pg_atomic_unlocked_test_flag_impl(ptr); } @@ -216,8 +210,6 @@ pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) static inline void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - pg_atomic_clear_flag_impl(ptr); }