Build tests/YGPersistenceTest.cpp fails with array-bounds error on GCC 16 (-O2 / -O3) due to -Werror
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- cpp
- Lĩnh vực
- build-system, testing-qa
Hướng nghiên cứu
Tái hiện lỗi bằng bản build GCC 16 CMake sử dụng -O2 hoặc bản build Release sử dụng -O3. Bắt đầu tại tests/YGPersistenceTest.cpp, khoảng dòng 277-278, và kiểm tra test về các child vừa được shared vừa được owned; được xem là hoàn tất khi target test build thành công với -Werror và các test chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Gentoo Linux use -O2 as default optimization option, there is a array-bounds error when use g++ -O2 or -O3
Step to reproduced:
export CXXFLAGS="-O2"
export CXX="g++"
cmake -B build -DBUILD_FUZZ_TESTS=OFF
cmake --build build -j1
or
export CXX="g++"
./unit_tests Release # CMAKE_BUILD_TYPE=Release will use -O3
array-bounds error log:
[ 27%] Building CXX object tests/CMakeFiles/yogatests.dir/YGPersistenceTest.cpp.o
cd /tmp/yoga/build/tests && /usr/bin/g++ -I/tmp/yoga/yoga/.. -isystem /tmp/yoga/build/_deps/googletest-src/googletest/include -isystem /tmp/yoga/build/_deps/googletest-src/googletest -O2 -fPIE -fvisibility=hidden -fno-omit-frame-pointer -fexceptions -Wall -Werror -frtti -MD -MT tests/CMakeFiles/yogatests.dir/YGPersistenceTest.cpp.o -MF CMakeFiles/yogatests.dir/YGPersistenceTest.cpp.o.d -o CMakeFiles/yogatests.dir/YGPersistenceTest.cpp.o -c /tmp/yoga/tests/YGPersistenceTest.cpp
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_tempbuf.h:61,
from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/memory:68,
from /tmp/yoga/build/_deps/googletest-src/googletest/include/gtest/gtest.h:54,
from /tmp/yoga/tests/YGPersistenceTest.cpp:8:
In function ‘constexpr _Tp* std::construct_at(_Tp*, _Args&& ...) [with _Tp = facebook::yoga::Node*; _Args = {facebook::yoga::Node*}]’,
inlined from ‘static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = facebook::yoga::Node*; _Args = {facebook::yoga::Node*}; _Tp = facebook::yoga::Node*]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/alloc_traits.h:716:21,
inlined from ‘constexpr void std::vector<_Tp, _Alloc>::_M_insert_aux(iterator, _Arg&&) [with _Arg = facebook::yoga::Node*; _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/vector.tcc:434:31,
inlined from ‘constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::_M_insert_rval(const_iterator, value_type&&) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/vector.tcc:381:17,
inlined from ‘constexpr std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_vector.h:1519:30,
inlined from ‘virtual void YogaTest_mixed_shared_and_owned_children_Test::TestBody()’ at /tmp/yoga/tests/YGPersistenceTest.cpp:278:18:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_construct.h:110:16: error: array subscript -1 is outside array bounds of ‘facebook::yoga::Node* [1152921504606846975]’ [-Werror=array-bounds=]
110 | return ::new(__loc) _Tp(std::forward<_Args>(__args)...);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/allocator.h:46,
from /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/memory:67:
In member function ‘constexpr _Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp = facebook::yoga::Node*]’,
inlined from ‘constexpr _Tp* std::allocator< <template-parameter-1-1> >::allocate(std::size_t) [with _Tp = facebook::yoga::Node*]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/allocator.h:206:40,
inlined from ‘static constexpr _Tp* std::allocator_traits<std::allocator<_Up> >::allocate(allocator_type&, size_type) [with _Tp = facebook::yoga::Node*]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/alloc_traits.h:638:28,
inlined from ‘constexpr std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_vector.h:389:33,
inlined from ‘constexpr void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_vector.h:407:44,
inlined from ‘constexpr std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_vector.h:341:26,
inlined from ‘constexpr std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = facebook::yoga::Node*; _Alloc = std::allocator<facebook::yoga::Node*>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_vector.h:623:61,
inlined from ‘virtual void YogaTest_mixed_shared_and_owned_children_Test::TestBody()’ at /tmp/yoga/tests/YGPersistenceTest.cpp:277:64:
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/new_allocator.h:162:75: note: at offset -8 into object of size [0, 9223372036854775800] allocated by ‘operator new’
162 | return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
| ^
cc1plus: all warnings being treated as errors
gmake[2]: *** [tests/CMakeFiles/yogatests.dir/build.make:446: tests/CMakeFiles/yogatests.dir/YGPersistenceTest.cpp.o] Error 1
gmake[2]: Leaving directory '/tmp/yoga/build'
gmake[1]: *** [CMakeFiles/Makefile2:258: tests/CMakeFiles/yogatests.dir/all] Error 2
gmake[1]: Leaving directory '/tmp/yoga/build'
gmake: *** [Makefile:139: all] Error 2
- Ngôn ngữ chính
- C++
- Star
- 18.9k
- Fork
- 1.6k
- Merge trung bình
- 1 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react/yoga
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
react/yoga#2027 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] flex-wrap: balanceĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
grumpycoders/pcsx-redux#2171 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
bytedance/trae-agent#524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update OPENEXR_IMATH_TAGĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
AcademySoftwareFoundation/openexr#2683 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
microsoft/onnxruntime#32881 ·
Maintainer thường phản hồi trong vòng 1 ngày