Skip to content

GCC compiler warning in node_buffer.cc #33392

Closed

Description

@targos

With gcc (GCC) 10.0.1 20200430 (Red Hat 10.0.1-0.14)

FAILED: obj/src/libnode.node_buffer.o 
c++ -MMD -MF obj/src/libnode.node_buffer.o.d -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -D__STDC_FORMAT_MACROS -DOPENSSL_NO_PINSHARED -DOPENSSL_THREADS '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' -DNODE_WANT_INTERNALS=1 -DV8_DEPRECATION_WARNINGS=1 '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' -DHAVE_INSPECTOR=1 -DNODE_ENABLE_LARGE_CODE_PAGES=1 -D__POSIX__ -DNODE_USE_V8_PLATFORM=1 -DNODE_HAVE_I18N_SUPPORT=1 -DHAVE_OPENSSL=1 -DUCONFIG_NO_SERVICE=1 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION=1 -DU_HAVE_STD_STRING=1 -DUCONFIG_NO_BREAK_ITERATION=0 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200112 -DNGHTTP2_STATICLIB -I../../src -Igen -Igen/include -Igen/src -I../../deps/histogram/src -I../../deps/uvwasi/include -I../../deps/v8/include -I../../deps/icu-small/source/i18n -I../../deps/icu-small/source/common -I../../deps/zlib -I../../deps/llhttp/include -I../../deps/cares/include -I../../deps/uv/include -I../../deps/nghttp2/lib/includes -I../../deps/brotli/c/include -I../../deps/openssl/openssl/include -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -Werror -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y  -c ../../src/node_buffer.cc -o obj/src/libnode.node_buffer.o
../../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::Fill(const v8::FunctionCallbackInfo<v8::Value>&)’:
../../src/node_buffer.cc:667:35: error: ‘start’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  667 |   char* ptr = ts_obj_data + start + str_length;
      |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Activity

  1. added
    c++
    build
    on May 14, 2020
  2. bnoordhuis commented on May 14, 2020

    @bnoordhuis
    Member

    It's a false positive. start is initialized but I suspect the use of goto in that function throws off gcc's heuristic.

  3. targos commented on May 16, 2020

    @targos
    MemberAuthor

    Another one:

    ../../src/node.cc: In function ‘void node::AtomicsWaitCallback(v8::Isolate::AtomicsWaitEvent, v8::Local<v8::SharedArrayBuffer>, size_t, int64_t, double, v8::Isolate::AtomicsWaitWakeHandle*, void*)’:
    ../../src/node.cc:256:10: error: ‘message’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      256 |   fprintf(stderr,
          |   ~~~~~~~^~~~~~~~
      257 |           "(node:%d) [Thread %" PRIu64 "] Atomics.wait(%p + %zx, %" PRId64
          |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      258 |               ", %.f) %s\n",
          |               ~~~~~~~~~~~~~~
      259 |           static_cast<int>(uv_os_getpid()),
          |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      260 |           env->thread_id(),
          |           ~~~~~~~~~~~~~~~~~
      261 |           array_buffer->GetBackingStore()->Data(),
          |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      262 |           offset_in_bytes,
          |           ~~~~~~~~~~~~~~~~
      263 |           value,
          |           ~~~~~~
      264 |           timeout_in_ms,
          |           ~~~~~~~~~~~~~~
      265 |           message);
          |           ~~~~~~~~
    cc1plus: all warnings being treated as errors
    
  4. richardlau commented on Sep 1, 2021

    @richardlau
    Member

    Was this fixed by #38722?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildc++

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions