aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-10-16 21:17:34 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-10-16 21:17:34 +0000
commitfa2e95b48a0b2ecd58c3778fe07acfd85cca49d0 (patch)
tree66c3e464bdb203fbc57b1fd07af3bd7ba2f6e205 /storage
parent390c85e540139593ef30a2bf2f77df8d4ad92c5c (diff)
Avoid gcc 12 bug when compiled for x86-64 and haswell or newer cpu.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
index 871cdaddb53..582b67a4dbc 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp
@@ -897,7 +897,13 @@ FileStorHandlerImpl::flush()
uint64_t
FileStorHandlerImpl::dispersed_bucket_bits(const document::Bucket& bucket) noexcept {
const uint64_t raw_id = bucket.getBucketId().getId();
- return XXH3_64bits(&raw_id, sizeof(uint64_t));
+ /*
+ * This is a workaround for gcc 12 and on that produces incorrect warning when compiled with -march=haswell or newer
+ * See document/src/vespa/document/bucket/bucketid.cpp: In member function ‘uint64_t document::BucketId::hash::operator()(const document::BucketId&) const
+ */
+ uint8_t raw_as_bytes[sizeof(raw_id)];
+ memcpy(raw_as_bytes, &raw_id, sizeof(raw_id));
+ return XXH3_64bits(&raw_as_bytes, sizeof(raw_id));
}
FileStorHandlerImpl::Stripe::Stripe(const FileStorHandlerImpl & owner, MessageSender & messageSender)