jrouwe/JoltPhysics

GCC 11 output may be truncated copying 15 bytes from a string of length 63

Closed this issue · 1 comments

For now here is record of the issue I've run into, I can provide more findings later:

In file included from /usr/include/string.h:535,
                 from /home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Build/../Jolt/Core/Core.h:385,
                 from /home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Build/..//Jolt/Jolt.h:8,
                 from /home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-build/CMakeFiles/Jolt.dir/cmake_pch.hxx:,
                 from <command-line>:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘void JPH::SetThreadName(const char*)’ at /home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Jolt/Core/JobSystemThreadPool.cpp:301:10,
    inlined from ‘void JPH::JobSystemThreadPool::ThreadMain(int)’ at /home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Jolt/Core/JobSystemThreadPool.cpp:313:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:34: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output may be truncated copying 15 bytes from a string of length 63 [-Werror=stringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~

Compiler:

$ c++ --version
c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Easy fix.