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

array-bounds warning when compiling llfs with GCC 12 #161

Open
haoning66 opened this issue Aug 15, 2024 · 0 comments
Open

array-bounds warning when compiling llfs with GCC 12 #161

haoning66 opened this issue Aug 15, 2024 · 0 comments

Comments

@haoning66
Copy link

Our project depends on llfs and we are upgrading GCC from 11 to 12, a new warning shows up:

/usr/local/bin/ccache /opt/x86_64-linux-gnu/bin/g++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_STACKTRACE_ADDR2LINE_LOCATION="/usr/bin/addr2line" -DBOOST_STACKTRACE_USE_ADDR2LINE -DBOOST_STACKTRACE_USE_BACKTRACE -DBOOST_STACKTRACE_USE_NOOP -DFUSE_USE_VERSION=35 -DGFLAGS_DLL_DECLARE_FLAG="" -DGFLAGS_DLL_DEFINE_FLAG="" -D_BITS_UIO_EXT_H=1 -I/local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/build/Release -I/local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/libfu9a681877c429d/p/include/fuse3 -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/batte1dff8a2946d33/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/pcg-c4aa2cafcf36e3/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/proto4c4dac32c1fed/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/boost54a4f2bd8264f/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/libbaacacf737cb74b/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/glog01cd0c9915f3e/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/gflaga472e1ead60be/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/libun60b65e1489426/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/llfs2fc70535df331/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/cli11387b72d23d771/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/gtestac4120864d9e7/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/opens42d679073e3a9/p/include -isystem /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/libur3c2f6731755c1/p/include -fno-omit-frame-pointer -m64 -fno-omit-frame-pointer -O3 -DNDEBUG -fno-diagnostics-color -D_GNU_SOURCE -fno-omit-frame-pointer -Wall -Wextra -Werror -Werror=switch-enum -Wswitch-enum -Wsuggest-override -Woverloaded-virtual -DBATT_HEADER_ONLY=0 -DBATT_WITH_GLOG=1 -DBATT_WITH_PROTOBUF=1 -std=c++17 -D_BITS_UIO_EXT_H=1 -std=c++17 -MD -MT CMakeFiles/turtle_tree.dir/turtle/tree/testing/fake_batch.cpp.o -MF CMakeFiles/turtle_tree.dir/turtle/tree/testing/fake_batch.cpp.o.d -o CMakeFiles/turtle_tree.dir/turtle/tree/testing/fake_batch.cpp.o -c /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/testing/fake_batch.cpp
In file included from /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/leaf_layout.hpp:8,
from /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/edit_batch.hpp:5,
from /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/testing/fake_batch.hpp:5,
from /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/testing/fake_batch.cpp:1:
In member function 'void llfs::PackedArray::initialize(I) [with I = unsigned int; T = turtle_db::PackedEdit]',
inlined from 'turtle_db::testing::FakeBatch::FakeBatch(const turtle_db::TreeOptions&)' at /local/gitlab-runner-local-cache/.conan_2.2.2/p/b/turtl6fb4171fa3a98/b/src/turtle/tree/testing/fake_batch.cpp:20:39:
/local/gitlab-runner-local-cache/.conan_2.2.2/p/b/llfs2fc70535df331/p/include/llfs/packed_array.hpp:45:16: error: 'void* memset(void*, int, size_t)' offset [0, 6] is out of the bounds [0, 0] [-Werror=array-bounds]
45 | std::memset(this, 0, sizeof(PackedArray));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant