Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-19340

Vendored wiredtiger rand.c fails to compile without -fno-strict-aliasing

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.7
    • Affects Version/s: None
    • Component/s: Build, Internal Code, WiredTiger
    • Labels:
      None
    • Environment:
      Ubuntu 15.04, GCC 4.9.2
    • Fully Compatible
    • ALL
    • Hide

      Remove -fno-strict-aliasing from the top level SConstruct and build with a modern GCC.

      Show
      Remove -fno-strict-aliasing from the top level SConstruct and build with a modern GCC.

      If the -fno-strict-aliasing flag is removed from the top level SConstruct, the vendored WiredTiger sources in src/third_party/wiredtiger do not compile. In particular, the rand.c file generates strict aliasing errors:

      src/third_party/wiredtiger/src/support/rand.c: In function '__wt_random_init':
      src/third_party/wiredtiger/src/support/rand.c:57:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
        M_W(rnd) = 521288629;
        ^
      src/third_party/wiredtiger/src/support/rand.c: In function '__wt_random':
      src/third_party/wiredtiger/src/support/rand.c:78:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
        w = M_W(rnd);
        ^
      src/third_party/wiredtiger/src/support/rand.c:91:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
        M_W(rnd) = w = 18000 * (w & 65535) + (w >> 16);
        ^
      cc1: all warnings being treated as errors
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: