From fa2e95b48a0b2ecd58c3778fe07acfd85cca49d0 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 16 Oct 2023 21:17:34 +0000 Subject: Avoid gcc 12 bug when compiled for x86-64 and haswell or newer cpu. --- .../vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'storage') 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) -- cgit v1.2.3