aboutsummaryrefslogtreecommitdiffstats
path: root/document
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 /document
parent390c85e540139593ef30a2bf2f77df8d4ad92c5c (diff)
Avoid gcc 12 bug when compiled for x86-64 and haswell or newer cpu.
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/bucket/bucketid.cpp4
1 files changed, 3 insertions, 1 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));