Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC compiler warning in node_buffer.cc #33392

Closed
targos opened this issue May 14, 2020 · 3 comments
Closed

GCC compiler warning in node_buffer.cc #33392

targos opened this issue May 14, 2020 · 3 comments
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++.

Comments

@targos
Copy link
Member

targos commented May 14, 2020

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
@targos targos added c++ Issues and PRs that require attention from people who are familiar with C++. build Issues and PRs related to build files or the CI. labels May 14, 2020
@bnoordhuis
Copy link
Member

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

@targos
Copy link
Member Author

targos commented May 16, 2020

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

@richardlau
Copy link
Member

Was this fixed by #38722?

@targos targos closed this as completed Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++.
Projects
None yet
Development

No branches or pull requests

3 participants