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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.7
    • Component/s: Build, Internal Code, WiredTiger
    • Labels:
      None
    • Environment:
      Ubuntu 15.04, GCC 4.9.2
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

              Assignee:
              Unassigned Unassigned
              Reporter:
              acm Andrew Morrow
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: