From ae787cfa88dfd0f5add5932b297258c46af4e333 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 29 May 2014 10:34:20 -0400 Subject: [PATCH] Work around an apparent binding bug (GCC 4.8). A reference to h->seq passed to std::pair ostensibly could not bind because the header structure is packed. At first this looked like a more general unaligned access problem, but the only location the compiler rejects is a false positive. Signed-off-by: Matt Benjamin (cherry picked from commit c930a1f119069a424af28a618b0abff4947c221f) --- src/os/FileJournal.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index c6bd6167aaa4a..7eb7927e0412a 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -1758,7 +1758,12 @@ FileJournal::read_entry_result FileJournal::do_read_entry( // ok! if (seq) *seq = h->seq; - journalq.push_back(pair(h->seq, pos)); + + // works around an apparent GCC 4.8(?) compiler bug about unaligned + // bind by reference to (packed) h->seq + journalq.push_back( + pair(static_cast(h->seq), + static_cast(pos))); if (next_pos) *next_pos = pos; -- 2.39.5