Skip to content

Compiler warnings make test-linux workflow fail on v14.x #38718

Description

@targos

For example: https://github.com/nodejs/node/runs/2607695302?check_suite_focus=true

Some notes:

  • We do not see these warnings on master
  • --error-on-warn was backported to v14.3.0 so this is probably a regression in one of the commits that were backported to v14.17.

Activity

  1. added
    c++Issues and PRs that require attention from people who are familiar with C++.
    on May 18, 2021
  2. targos commented on May 18, 2021

    @targos
    MemberAuthor
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::UTF8]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:662:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      662 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::ASCII]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:662:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      662 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::BASE64]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::BINARY]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::HEX]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:662:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      662 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::UCS2]’:
    ../src/node_buffer.cc:665:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      665 |   if (offset > ts_obj_length) {
          |   ^~
    cc1plus: all warnings being treated as errors
    make[2]: *** [libnode.target.mk:345: /home/runner/work/node/node/out/Release/obj.target/libnode/src/node_buffer.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    
  3. richardlau commented on May 18, 2021

    @richardlau
    Member

    I see similar errors locally (Fedora 33 with gcc/g++ 10) with master.

    Details
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::Fill(const v8::FunctionCallbackInfo<v8::Value>&)’:
    ../src/node_buffer.cc:646:35: error: ‘start’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      646 |   char* ptr = ts_obj_data + start + str_length;
          |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::ASCII]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::BASE64]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::BASE64URL]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:672:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      672 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::BINARY]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:672:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      672 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::HEX]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::UCS2]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:672:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      672 |   size_t max_length;
          |          ^~~~~~~~~~
    ../src/node_buffer.cc: In function ‘void node::Buffer::{anonymous}::StringWrite(const v8::FunctionCallbackInfo<v8::Value>&) [with node::encoding encoding = node::UTF8]’:
    ../src/node_buffer.cc:675:3: error: ‘offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      675 |   if (offset > ts_obj_length) {
          |   ^~
    ../src/node_buffer.cc:672:10: error: ‘max_length’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      672 |   size_t max_length;
          |          ^~~~~~~~~~
    cc1plus: all warnings being treated as errors
    
  4. targos commented on May 19, 2021

    @targos
    MemberAuthor

    Interesting. I do not see any errors with GCC 8.4 (CentOS 8)

  5. richardlau commented on May 19, 2021

    @richardlau
    Member

    On CentOS Stream release 8 I do not get errors with either the default GCC 8.4 or GCC 9.2 (via gcc-toolset-9) but do get them with GCC 10.2 (gcc-toolset-10).

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

    c++Issues and PRs that require attention from people who are familiar with C++.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions