aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--document/src/vespa/document/bucket/bucketid.cpp4
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp8
2 files changed, 10 insertions, 2 deletions
diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp
index 8422b34473c..dee818b407e 100644
--- a/document/src/vespa/document/bucket/bucketid.cpp
+++ b/document/src/vespa/document/bucket/bucketid.cpp
@@ -81,7 +81,7 @@ uint64_t
BucketId::hash::operator () (const BucketId& bucketId) const noexcept {
const uint64_t raw_id = bucketId.getId();
/*
- * This is a workaround for gcc 12 and on that produces incorrect warning
+ * This is a workaround for gcc 12 and on that produces incorrect warning when compiled with -march=haswell or newer
* /home/balder/git/vespa/document/src/vespa/document/bucket/bucketid.cpp: In member function ‘uint64_t document::BucketId::hash::operator()(const document::BucketId&) const’:
* /home/balder/git/vespa/document/src/vespa/document/bucket/bucketid.cpp:83:23: error: ‘raw_id’ may be used uninitialized [-Werror=maybe-uninitialized]
* 83 | return XXH3_64bits(&raw_id, sizeof(uint64_t));
@@ -95,6 +95,8 @@ BucketId::hash::operator () (const BucketId& bucketId) const noexcept {
* 82 | uint64_t raw_id = bucketId.getId();
* | ^~~~~~
* cc1plus: all warnings being treated as errors
+ *
+ * Same issue in storage/src/vespa/storage/persistence/filestorhandlerimpl.cpp:FileStorHandlerImpl::dispersed_bucket_bits
*/
uint8_t raw_as_bytes[sizeof(raw_id)];
memcpy(raw_as_bytes, &raw_id, sizeof(raw_id));
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)