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

i am using -Wconditional-uninitialized flag and then i am getting some errrors from the library. #15865

Closed
ananta-code opened this issue Jul 13, 2022 · 5 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug

Comments

@ananta-code
Copy link

i am using -Wconditional-uninitialized flag and then i am getting some errrors from the library.

external/com_google_protobuf/src/google/protobuf/arena.cc:398:12: error: variable 'arena' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get());
^~~~~
external/com_google_protobuf/src/google/protobuf/arena.cc:395:21: note: initialize the variable 'arena' to silence this warning
SerialArena* arena;
^
= nullptr
1 error generated.

i want to filter out this error since it is coming from the library and i am using Bazel 5.0 and feature : build --features=external_include_paths but still i am seeing the above error from the library.

Could you please help me on this?

Originally posted by @ananta-code in #12009 (comment)

@sgowroji
Copy link
Member

Hello @ananta-code, Can you please provide complete steps to reproduce the above error. Thanks !

@ananta-code
Copy link
Author

Hello @ananta-code, Can you please provide complete steps to reproduce the above error. Thanks !

@sgowroji I have a bazel build and i am using clang compiler aruguments to build c++ app.
the bazel rc content is like this:

build --stamp
build --workspace_status_command bazel/get_workspace_status
build --features=external_include_paths
build --repo_env=BAZEL_CXXOPTS="-std=c++17:-Werror:-Wextra:-Wnon-virtual-dtor:-Woverloaded-virtual:-Wno-sign-compare:-Wunreachable-code:-Wno-unused-parameter:-Wno-error=missing-field-initializers:-Wno-error=deprecated-declarations:-Wno-error=ignored-qualifiers:-Wno-error=unused-variable:-Wno-error=unreachable-code:-Wno-error=implicit-fallthrough:-Wno-error=implicit-int-float-conversion:-Wno-unknown-warning-option:-Wno-error=unused-function:-Wconditional-uninitialized"

and i am building app with these compiler option and then getting error from the library.
ERROR: /home/temp/.cache/bazel/_bazel_sabre2/57c0574d1f367333dd959780f3f5b13f/external/com_google_protobuf/BUILD:155:11: Compiling src/google/protobuf/arena.cc [for host] failed: (Exit 1): clang-10 failed: error executing command /usr/bin/clang-10 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 46 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/com_google_protobuf/src/google/protobuf/arena.cc:398:12: error: variable 'arena' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get());
^~~~~
external/com_google_protobuf/src/google/protobuf/arena.cc:395:21: note: initialize the variable 'arena' to silence this warning
SerialArena* arena;
^
= nullptr
1 error generated.

Since i am using features=external_include_paths i am not expecting this error from the library.

and in my BUILD i am loading these libraries.
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
load("//bazel:plantuml.bzl", "plantuml")
load("//bazel:service.bzl", "service")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_proto_library", "cc_test")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_proto//proto:defs.bzl", "proto_library")

@ananta-code
Copy link
Author

ananta-code commented Jul 13, 2022

@sgowroji thanks for your respone.
my issue is similar to #15762.
why you tagged it as not a bug.

also could you please help me on #15762

@oquenchil oquenchil added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Oct 26, 2022
copybara-service bot pushed a commit that referenced this issue Jan 27, 2023
Potentially fix #15762 and #15865 (if they depend on windows).

Linked to 08936ae

Closes #16694.

PiperOrigin-RevId: 505084880
Change-Id: Ie4dc08a0e93c76419b6164bacccadac32a7c7b2f
hvadehra pushed a commit that referenced this issue Feb 14, 2023
Potentially fix #15762 and #15865 (if they depend on windows).

Linked to 08936ae

Closes #16694.

PiperOrigin-RevId: 505084880
Change-Id: Ie4dc08a0e93c76419b6164bacccadac32a7c7b2f
lripoche added a commit to lripoche/bazel that referenced this issue Apr 20, 2023
Potentially fix bazelbuild#15762 and bazelbuild#15865 (if they depend on windows).

Linked to 08936ae

Closes bazelbuild#16694.

PiperOrigin-RevId: 505084880
Change-Id: Ie4dc08a0e93c76419b6164bacccadac32a7c7b2f
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Dec 31, 2023
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

3 participants