]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Work around an apparent binding bug (GCC 4.8).
authorMatt Benjamin <matt@linuxbox.com>
Thu, 29 May 2014 14:34:20 +0000 (10:34 -0400)
committerSage Weil <sage@redhat.com>
Mon, 18 Aug 2014 17:51:59 +0000 (10:51 -0700)
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 <matt@linuxbox.com>
(cherry picked from commit c930a1f119069a424af28a618b0abff4947c221f)

src/os/FileJournal.cc

index c6bd6167aaa4a06b27531b923e5b1598c467b1da..7eb7927e0412a476043e603d1d3110f826769424 100644 (file)
@@ -1758,7 +1758,12 @@ FileJournal::read_entry_result FileJournal::do_read_entry(
   // ok!
   if (seq)
     *seq = h->seq;
-  journalq.push_back(pair<uint64_t,off64_t>(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<uint64_t,off64_t>(static_cast<uint64_t>(h->seq),
+                          static_cast<off64_t>(pos)));
 
   if (next_pos)
     *next_pos = pos;