‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 9
Closed this issue · 2 comments
tksuoran commented
Another compilation warning/error issue
/home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Jolt/Core/JobSystemThreadPool.cpp: In member function ‘void JPH::JobSystemThreadPool::ThreadMain(int)’:
/home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Jolt/Core/JobSystemThreadPool.cpp:309:46: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 9 [-Werror=format-truncation=]
309 | snprintf(name, sizeof(name), "Worker %d", int(inThreadIndex + 1));
| ^~
/home/tksuoran/git/tksuoran/erhe/build/_deps/joltphysics-src/Jolt/Core/JobSystemThreadPool.cpp:309:38: note: directive argument in the range [-2147483647, 2147483647]
309 | snprintf(name, sizeof(name), "Worker %d", int(inThreadIndex + 1));
| ^~~~~~~~~~~
Compiler:
g++ (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.
jrouwe commented
I'm on the same compiler version as you and I don't get this warning. Only if I explicitly modify CMakeLists.txt to add -Wformat-truncation=2
I get it. I'm guessing you're enabling extra warnings from your parent project so I'm working a bit blind here. In any case this particular warning is fixed now.
tksuoran commented
Thanks!