Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10698

build failed with -Werror=maybe-uninitialized in Release mode

    • Type: Icon: Build Failure Build Failure
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      my commit version is e297e55f2  on develop branch.

      compile command: 

      cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/opt/wt -DCMAKE_BUILD_TYPE=Release

      the compile error is :

       

      [18/572] Building C object CMakeFiles/wt_objs.dir/src/btree/bt_compact.c.o FAILED: CMakeFiles/wt_objs.dir/src/btree/bt_compact.c.o /usr/bin/cc  -I/usr/include/python3.9 -Iinclude -Iconfig -I../src/include -frecord-gcc-switches -D_GNU_SOURCE -DHAVE_X86INTRIN_H  -DNDEBUG -fPIC -O2 -Wcast-align -Wdouble-promotion -Werror -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-field-initializers -Wpacked -Wpointer-arith -Wredundant-decls -Wswitch-enum -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wwrite-strings -Wno-error=unsafe-loop-optimizations -Wformat-signedness -Wunused-macros -Wvariadic-macros -Wduplicated-cond -Wlogical-op -Wunused-const-variable=2 -Walloca -Walloc-zero -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wrestrict -Wmultistatement-macros -Waggregate-return -Wall -Wextra -Wshadow -Wsign-conversion -Wbad-function-cast -Wdeclaration-after-statement -Wjump-misses-init -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-sign -Wstrict-prototypes -MD -MT CMakeFiles/wt_objs.dir/src/btree/bt_compact.c.o -MF CMakeFiles/wt_objs.dir/src/btree/bt_compact.c.o.d -o CMakeFiles/wt_objs.dir/src/btree/bt_compact.c.o -c ../src/btree/bt_compact.c In file included from ../src/include/wt_internal.h:481,                  from ../src/btree/bt_compact.c:9: In function ‘__cell_addr_window_cleanup’,     inlined from ‘__cell_unpack_window_cleanup’ at ../src/include/cell_inline.h:1174:5,     inlined from ‘__wt_cell_unpack_addr’ at ../src/include/cell_inline.h:1187:5,     inlined from ‘__compact_page_replace_addr’ at ../src/btree/bt_compact.c:112:9,     inlined from ‘__compact_page’ at ../src/btree/bt_compact.c:190:13: ../src/include/cell_inline.h:1055:24: error: ‘unpack.raw’ may be used uninitialized [-Werror=maybe-uninitialized]  1055 |         if (unpack_addr->raw == WT_CELL_ADDR_DEL && F_ISSET(dsk, WT_PAGE_FT_UPDATE)) {       |             ~~~~~~~~~~~^~~~~ ../src/btree/bt_compact.c: In function ‘__compact_page’: ../src/btree/bt_compact.c:99:25: note: ‘unpack’ declared here    99 |     WT_CELL_UNPACK_ADDR unpack;       |                         ^~~~~~ In function ‘__compact_page_replace_addr’,     inlined from ‘__compact_page’ at ../src/btree/bt_compact.c:190:13: ../src/btree/bt_compact.c:121:23: error: ‘unpack.raw’ may be used uninitialized [-Werror=maybe-uninitialized]   121 |         switch (unpack.raw) {       |                 ~~~~~~^~~~ ../src/btree/bt_compact.c: In function ‘__compact_page’: ../src/btree/bt_compact.c:99:25: note: ‘unpack’ declared here    99 |     WT_CELL_UNPACK_ADDR unpack;       |                         ^~~~~~ cc1: all warnings being treated as errors [20/572] Building C object CMakeFiles/wt_objs.dir/src/btree/bt_curprev.c.o ninja: build stopped: subcommand failed.

       

       

      Another question is that I cann't find the option `-Werror=maybe-uninitialized` in any build files except those:

       

      ../src/support/modify.c:246:    WT_CLEAR(prev); /* [-Werror=maybe-uninitialized] */
      ../src/reconcile/rec_write.c:1329:    aux_first_free = 0; /* gcc -Werror=maybe-uninitialized, with -O3 */
      ../src/block/block_ckpt_scan.c:251:    ext_off = 0; /* [-Werror=maybe-uninitialized] */
      ../src/block/block_write.c:224:    *offsetp = 0;   /* -Werror=maybe-uninitialized */
      ../src/block/block_write.c:225:    *sizep = 0;     /* -Werror=maybe-uninitialized */
      ../src/block/block_write.c:226:    *checksump = 0; /* -Werror=maybe-uninitialized */
      ../src/block/block_compact.c:260:    new_offset = 0; /* -Werror=maybe-uninitialized */
      ../src/btree/row_key.c:63:    key_data = NULL; /* -Werror=maybe-uninitialized */
      ../src/btree/row_key.c:64:    key_size = 0;    /* -Werror=maybe-uninitialized */
      ../src/btree/bt_curprev.c:394:    rle_start = 0; /* -Werror=maybe-uninitialized */
      ../src/btree/bt_curnext.c:226:    rle_start = 0; /* -Werror=maybe-uninitialized */
      ../src/btree/bt_curnext.c:550:    cmp = 0; /* -Werror=maybe-uninitialized */
      ../src/btree/bt_curnext.c:594:    cmp = 0; /* -Werror=maybe-uninitialized */
      ../test/packing/packing-test.c:43:    len = 0; /* -Werror=maybe-uninitialized */
      ../test/packing/intpack-test.c:45:    memset(buf, 0xff, sizeof(buf)); /* -Werror=maybe-uninitialized */
      ../test/packing/intpack-test3.c:48:    memset(buf, 0xff, sizeof(buf)); /* -Werror=maybe-uninitialized */
      ../test/packing/intpack-test3.c:50:    soutput = 0; /* -Werror=maybe-uninitialized */
      ../test/packing/intpack-test2.c:43:    memset(buf, 0xff, sizeof(buf)); /* -Werror=maybe-uninitialized */

       

      I don't know why we add such comments purposely.

       
      RelWithDebInfo fails too. Debug mode is ok. 

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            baiwfg2@gmail.com Chan Lewis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: