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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • None
    • 3.1.7
    • Build, Internal Code, WiredTiger
    • None
    • 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.

    Description

      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
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: