summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2024-02-08 13:10:29 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2024-02-08 13:15:51 -0500
commit0c4a80b90e1f25b42e00a8af57131040203d2f89 (patch)
treeadc5608a1b374ab9d2b8888e199a6495b5d66839 /include
parentded1f979d101a5df37a65370f6c18803212edb66 (diff)
downloaddynamic-extension-0c4a80b90e1f25b42e00a8af57131040203d2f89.tar.gz
Added compiler fence to block reordering
I'm reasonably certain that this is a compiler bug...
Diffstat (limited to 'include')
-rw-r--r--include/shard/ISAMTree.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/shard/ISAMTree.h b/include/shard/ISAMTree.h
index 33ba82f..9458b1f 100644
--- a/include/shard/ISAMTree.h
+++ b/include/shard/ISAMTree.h
@@ -65,6 +65,12 @@ public:
sizeof(Wrapped<R>),
(byte**) &m_data);
+ /*
+ * without this, gcc seems to hoist the building of the array
+ * _above_ its allocation under -O3, resulting in memfaults.
+ */
+ asm volatile ("" ::: "memory");
+
auto res = sorted_array_from_bufferview(std::move(buffer), m_data, m_bf);
m_reccnt = res.record_count;
m_tombstone_cnt = res.tombstone_count;