assimp / assimp

The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.
https://www.assimp.org
Other
10.39k stars 2.83k forks source link

Bug: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 8 is out of the bounds [0, 8] [-Werror=array-bounds=] #5557

Open jiapei100 opened 1 month ago

jiapei100 commented 1 month ago

Describe the bug

[ 35%] Building CXX object code/CMakeFiles/assimp.dir/AssetLib/Blender/BlenderScene.cpp.o
cd ....../assimp/build/code && /usr/bin/c++ -DASSIMP_BUILD_DLL_EXPORT -DASSIMP_BUILD_NO_C4D_IMPORTER -DASSIMP_BUILD_NO_M3D_EXPORTER -DASSIMP_BUILD_NO_M3D_IMPORTER -DASSIMP_BUILD_NO_OWN_ZLIB -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0 -DOPENDDLPARSER_BUILD -DRAPIDJSON_HAS_STDSTRING=1 -DRAPIDJSON_NOMEMBERITERATORCLASS -Dassimp_EXPORTS -I....../assimp/build/include -I....../assimp/build -I....../assimp/include -I....../assimp/code -I....../assimp/. -I....../assimp/code/../contrib/pugixml/src -I....../assimp/code/../contrib/utf8cpp/source -I....../assimp/code/../contrib/rapidjson/include -I....../assimp/code/../contrib -I....../assimp/code/../contrib/openddlparser/include -I....../assimp/code/../include -I....../assimp/build/code/../include -I/usr/include/minizip -fvisibility=hidden -fno-strict-aliasing -Wall -std=c++17 -fPIC -O3 -DNDEBUG -std=gnu++17 -fPIC -Wno-dangling-reference -Wall -Werror -MD -MT code/CMakeFiles/assimp.dir/AssetLib/Blender/BlenderScene.cpp.o -MF CMakeFiles/assimp.dir/AssetLib/Blender/BlenderScene.cpp.o.d -o CMakeFiles/assimp.dir/AssetLib/Blender/BlenderScene.cpp.o -c ....../assimp/code/AssetLib/Blender/BlenderScene.cpp
In file included from /usr/include/c++/13/bits/specfun.h:43,
                 from /usr/include/c++/13/cmath:3699,
                 from ....../assimp/include/assimp/vector2.h:53,
                 from ....../assimp/include/assimp/types.h:64,
                 from ....../assimp/include/assimp/IOStream.hpp:53,
                 from ....../assimp/include/assimp/DefaultIOStream.h:55,
                 from ....../assimp/include/assimp/Exceptional.h:49,
                 from ....../assimp/include/assimp/BaseImporter.h:52,
                 from ....../assimp/code/AssetLib/MDL/MDLLoader.h:48,
                 from ....../assimp/code/AssetLib/MDL/MDLLoader.cpp:51:
In static member function ‘static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = long unsigned int; _Up = long unsigned int; bool _IsMove = false]’,
    inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:506:30,
    inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:533:42,
    inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = long unsigned int*; _OI = long unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:540:31,
    inlined from ‘_OI std::copy(_II, _II, _OI) [with _II = long unsigned int*; _OI = long unsigned int*]’ at /usr/include/c++/13/bits/stl_algobase.h:633:7,
    inlined from ‘std::vector<bool, _Alloc>::iterator std::vector<bool, _Alloc>::_M_copy_aligned(const_iterator, const_iterator, iterator) [with _Alloc = std::allocator<bool>]’ at /usr/include/c++/13/bits/stl_bvector.h:1342:28,
    inlined from ‘void std::vector<bool, _Alloc>::_M_reallocate(size_type) [with _Alloc = std::allocator<bool>]’ at /usr/include/c++/13/bits/vector.tcc:851:40,
    inlined from ‘void std::vector<bool, _Alloc>::reserve(size_type) [with _Alloc = std::allocator<bool>]’ at /usr/include/c++/13/bits/stl_bvector.h:1130:17,
    inlined from ‘Assimp::MDL::IntSharedData_MDL7::IntSharedData_MDL7()’ at ....../assimp/code/AssetLib/MDL/MDLFileData.h:879:32,
    inlined from ‘void Assimp::MDLImporter::InternReadFile_3DGS_MDL7()’ at ....../assimp/code/AssetLib/MDL/MDLLoader.cpp:1360:29:
/usr/include/c++/13/bits/stl_algobase.h:437:30: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 8 is out of the bounds [0, 8] [-Werror=array-bounds=]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To Reproduce Steps to reproduce the behavior: Just cmake and build.

Expected behavior Successfully compiled...

Screenshots N/A

Platform (please complete the following information):

Additional context N/A

kimkulling commented 3 weeks ago

Does this happen on the latest release?

LuLuc commented 2 weeks ago

Hello,

I have the same issue from the tag v5.3.1 and v5.4.0 using g++ 13.2.0 on debian. When i build with the parameter -DCMAKE_BUILD_TYPE=Debug it compile but when i build with -DCMAKE_BUILD_TYPE=Release I have the same error and it doesn't compile.

dbs4261 commented 2 weeks ago

Seems to still be the case with v5.4.1 and both GCC 13.2.0 and GCC 14.0.1. Release and MinSizeRel fail, while Debug and RelWithDebInfo compile fine. Same version compiles fine under Clang 18.1.3

dbs4261 commented 2 weeks ago

Seems to be linked to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107852