godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.33k stars 21.24k forks source link

[3.x] Linking warnings in official builds with LTO (`-Wstringop-overflow=` and `-Wattributes`) #50910

Open akien-mga opened 3 years ago

akien-mga commented 3 years ago

Godot version

3.x (52df2940bc3e8dfbe97bd2029badb831d772257c)

System information

Fedora 34 host, multiple target platforms

Issue description

When building official builds with https://github.com/godotengine/godot-build-scripts with LTO, I get a number of linking warnings. This is not new and doesn't prevent linking, but I'm finally taking time to list them so that we can see if they're fixable.

Windows MinGW GCC 10

Editor 64-bit release_debug

x86_64-w64-mingw32-g++ -o bin/godot.windows.opt.tools.64.exe -static -flto=64 -Wl,--stack,8388608 -Wl,--nxcompat platform/windows/godot_windows.windows.opt.tools.64.o platform/windows/context_gl_windows.windows.
opt.tools.64.o platform/windows/crash_handler_windows.windows.opt.tools.64.o platform/windows/os_windows.windows.opt.tools.64.o platform/windows/key_mapping_windows.windows.opt.tools.64.o platform/windows/joypad
_windows.windows.opt.tools.64.o platform/windows/power_windows.windows.opt.tools.64.o platform/windows/windows_terminal_logger.windows.opt.tools.64.o platform/windows/godot_res.windows.opt.tools.64.o main/libmai
n.windows.opt.tools.64.a main/tests/libtests.windows.opt.tools.64.a modules/libmodules.windows.opt.tools.64.a platform/libplatform.windows.opt.tools.64.a drivers/libdrivers.windows.opt.tools.64.a editor/libedito
r.windows.opt.tools.64.a scene/libscene.windows.opt.tools.64.a servers/libservers.windows.opt.tools.64.a core/libcore.windows.opt.tools.64.a modules/freetype/libfreetype_builtin.windows.opt.tools.64.a -lmingw32 
-lopengl32 -ldsound -lole32 -ld3d9 -lwinmm -lgdi32 -liphlpapi -lshlwapi -lwsock32 -lws2_32 -lkernel32 -loleaut32 -ldinput8 -ldxguid -lksuser -limm32 -lbcrypt -lavrt -luuid -ldwmapi -lpsapi
thirdparty/miniupnpc/miniupnpc/miniupnpc.c: In function 'GetUPNPUrls':
thirdparty/miniupnpc/miniupnpc/miniupnpc.c:496:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  496 | }
      | ^
thirdparty/miniupnpc/miniupnpc/upnpcommands.c: In function 'UPNP_GetExternalIPAddress':
thirdparty/miniupnpc/miniupnpc/upnpcommands.c:336:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  336 | }
      | ^
thirdparty/zstd/compress/zstd_compress.c: In function 'ZSTD_cParam_getBounds':
thirdparty/zstd/compress/zstd_compress.c:475:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  475 | }
      | ^
thirdparty/jpeg-compressor/jpgd.cpp: In member function 'make_huff_table':
thirdparty/jpeg-compressor/jpgd.cpp:2300:15: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 2300 |   huffsize[p] = 0;
      |               ^
thirdparty/jpeg-compressor/jpgd.cpp:2276:9: note: at offset [0, 2147483646] to object 'huffsize' with size 258 declared here
 2276 |   uint8 huffsize[258];
      |         ^
thirdparty/libwebp/src/enc/picture_enc.c: In function 'WebPMemoryWrite':
thirdparty/libwebp/src/enc/picture_enc.c:216:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  216 | }
      | ^
thirdparty/libwebp/src/utils/utils.c: In function 'WebPSafeMalloc':
thirdparty/libwebp/src/utils/utils.c:199:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  199 | }
      | ^
thirdparty/libwebp/src/enc/config_enc.c: In function 'WebPValidateConfig':
thirdparty/libwebp/src/enc/config_enc.c:129:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  129 | }
      | ^
thirdparty/libwebp/src/enc/picture_enc.c: In function 'WebPPictureAlloc':
thirdparty/libwebp/src/enc/picture_enc.c:167:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  167 | }
      | ^
thirdparty/libwebp/src/enc/picture_csp_enc.c: In function 'WebPPictureImportRGB':
thirdparty/libwebp/src/enc/picture_csp_enc.c:1194:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1194 | }
      | ^
thirdparty/libwebp/src/enc/picture_csp_enc.c: In function 'WebPPictureImportRGBA':
thirdparty/libwebp/src/enc/picture_csp_enc.c:1201:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1201 | }
      | ^
At top level:
lto1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]

Template 64-bit release

x86_64-w64-mingw32-g++ -o bin/godot.windows.opt.64.exe -Wl,--subsystem,windows -static -flto=64 -Wl,--stack,8388608 -Wl,--nxcompat platform/windows/godot_windows.windows.opt.64.o platform/windows/context_gl_wind
ows.windows.opt.64.o platform/windows/crash_handler_windows.windows.opt.64.o platform/windows/os_windows.windows.opt.64.o platform/windows/key_mapping_windows.windows.opt.64.o platform/windows/joypad_windows.win
dows.opt.64.o platform/windows/power_windows.windows.opt.64.o platform/windows/windows_terminal_logger.windows.opt.64.o platform/windows/godot_res.windows.opt.64.o main/libmain.windows.opt.64.a modules/libmodule
s.windows.opt.64.a platform/libplatform.windows.opt.64.a drivers/libdrivers.windows.opt.64.a scene/libscene.windows.opt.64.a servers/libservers.windows.opt.64.a core/libcore.windows.opt.64.a modules/freetype/lib
freetype_builtin.windows.opt.64.a -lmingw32 -lopengl32 -ldsound -lole32 -ld3d9 -lwinmm -lgdi32 -liphlpapi -lshlwapi -lwsock32 -lws2_32 -lkernel32 -loleaut32 -ldinput8 -ldxguid -lksuser -limm32 -lbcrypt -lavrt -l
uuid -ldwmapi
In member function 'get_packet',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      | 
In member function 'get_packet',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      | 
In member function 'get_packet',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      | 
thirdparty/libwebp/src/enc/picture_enc.c: In function 'WebPMemoryWrite':
thirdparty/libwebp/src/enc/picture_enc.c:216:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  216 | }
      | ^
thirdparty/libwebp/src/enc/config_enc.c: In function 'WebPValidateConfig':
thirdparty/libwebp/src/enc/config_enc.c:129:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  129 | }
      | ^
thirdparty/libwebp/src/utils/utils.c: In function 'WebPSafeMalloc':
thirdparty/libwebp/src/utils/utils.c:199:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  199 | }
      | ^
thirdparty/libwebp/src/enc/picture_csp_enc.c: In function 'WebPPictureImportRGB':
thirdparty/libwebp/src/enc/picture_csp_enc.c:1194:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1194 | }
      | ^
thirdparty/libwebp/src/enc/picture_csp_enc.c: In function 'WebPPictureImportRGBA':
thirdparty/libwebp/src/enc/picture_csp_enc.c:1201:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1201 | }
      | ^
thirdparty/miniupnpc/miniupnpc/upnpcommands.c: In function 'UPNP_GetExternalIPAddress':
thirdparty/miniupnpc/miniupnpc/upnpcommands.c:336:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  336 | }
      | ^
At top level:
lto1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]

Linux GCC 10

Editor, release_debug

g++ -o bin/godot.x11.opt.tools.64 -flto=64 -pipe -no-pie -static-libgcc -static-libstdc++ platform/x11/godot_x11.x11.opt.tools.64.o platform/x11/context_gl_x11.x11.opt.tools.64.o platform/x11/crash_handler_x11.x
11.opt.tools.64.o platform/x11/os_x11.x11.opt.tools.64.o platform/x11/key_mapping_x11.x11.opt.tools.64.o platform/x11/joypad_linux.x11.opt.tools.64.o platform/x11/power_x11.x11.opt.tools.64.o platform/x11/detect
_prime.x11.opt.tools.64.o platform/x11/libudev-so_wrap.x11.opt.tools.64.o -L/root/x86_64-godot-linux-gnu_sdk-buildroot/x86_64-godot-linux-gnu/sysroot/usr/lib main/libmain.x11.opt.tools.64.a main/tests/libtests.x
11.opt.tools.64.a modules/libmodules.x11.opt.tools.64.a platform/libplatform.x11.opt.tools.64.a drivers/libdrivers.x11.opt.tools.64.a editor/libeditor.x11.opt.tools.64.a scene/libscene.x11.opt.tools.64.a servers
/libservers.x11.opt.tools.64.a core/libcore.x11.opt.tools.64.a modules/freetype/libfreetype_builtin.x11.opt.tools.64.a -lXcursor -lXinerama -lXext -lXrandr -lXrender -lX11 -lXi -lGL -lpthread -ldl
In function 'getenv',
    inlined from 'getenv_int' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:73:15,
    inlined from 'dump_jit_code' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:121:35,
    inlined from 'register_jit_code' at thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jit_utils.cpp:102:18,
    inlined from 'getCode' at thirdparty/oidn/mkl-dnn/src/cpu/jit_generator.hpp:760:37,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.hpp:43:56,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.hpp:191:31,
    inlined from '__ct_base ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_convolution.hpp:80:19:
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:57:20: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   57 |             strncpy(buffer, value, value_length);
      |                    ^
thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_convolution.hpp: In member function '__ct_base ':
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:44:46: note: length computed here
   44 |     value_length = value == NULL ? 0 : strlen(value);
      |                                              ^
In function 'getenv',
    inlined from 'getenv_int' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:73:15,
    inlined from 'dump_jit_code' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:121:35,
    inlined from 'register_jit_code' at thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jit_utils.cpp:102:18,
    inlined from 'getCode' at thirdparty/oidn/mkl-dnn/src/cpu/jit_generator.hpp:760:37,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.hpp:43:56,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.hpp:185:31,
    inlined from '__ct_base ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_convolution.hpp:80:19:
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:57:20: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   57 |             strncpy(buffer, value, value_length);
      |                    ^
thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_common_convolution.hpp: In member function '__ct_base ':
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:44:46: note: length computed here
   44 |     value_length = value == NULL ? 0 : strlen(value);
      |                                              ^
In function 'getenv',
    inlined from 'getenv_int' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:73:15,
    inlined from 'dump_jit_code' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:121:35,
    inlined from 'register_jit_code' at thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jit_utils.cpp:102:18,
    inlined from 'getCode' at thirdparty/oidn/mkl-dnn/src/cpu/jit_generator.hpp:760:37,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_uni_pool_kernel_f32.hpp:41:51,
    inlined from '__ct_base ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_uni_pooling.hpp:77:17:
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:57:20: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   57 |             strncpy(buffer, value, value_length);
      |                    ^
thirdparty/oidn/mkl-dnn/src/cpu/jit_uni_pooling.hpp: In member function '__ct_base ':
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:44:46: note: length computed here
   44 |     value_length = value == NULL ? 0 : strlen(value);
      |                                              ^
In function 'getenv',
    inlined from 'getenv_int' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:73:15,
    inlined from 'dump_jit_code' at thirdparty/oidn/mkl-dnn/src/common/utils.cpp:121:35,
    inlined from 'register_jit_code' at thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jit_utils.cpp:102:18,
    inlined from 'getCode' at thirdparty/oidn/mkl-dnn/src/cpu/jit_generator.hpp:760:37,
    inlined from '__ct ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp:403:46,
    inlined from '__ct_base ' at thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp:844:38:
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:57:20: warning: '__builtin_strncpy' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   57 |             strncpy(buffer, value, value_length);
      |                    ^
thirdparty/oidn/mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp: In member function '__ct_base ':
thirdparty/oidn/mkl-dnn/src/common/utils.cpp:44:46: note: length computed here
   44 |     value_length = value == NULL ? 0 : strlen(value);
      |                                              ^

[[[ and plenty more like this ]]]

Template 64-bit release

g++ -o bin/godot.x11.opt.64 -flto=64 -pipe -no-pie -T platform/x11/pck_embed.ld -static-libgcc -static-libstdc++ platform/x11/godot_x11.x11.opt.64.o platform/x11/context_gl_x11.x11.opt.64.o platform/x11/crash_ha
ndler_x11.x11.opt.64.o platform/x11/os_x11.x11.opt.64.o platform/x11/key_mapping_x11.x11.opt.64.o platform/x11/joypad_linux.x11.opt.64.o platform/x11/power_x11.x11.opt.64.o platform/x11/detect_prime.x11.opt.64.o
 platform/x11/libudev-so_wrap.x11.opt.64.o -L/root/x86_64-godot-linux-gnu_sdk-buildroot/x86_64-godot-linux-gnu/sysroot/usr/lib main/libmain.x11.opt.64.a modules/libmodules.x11.opt.64.a platform/libplatform.x11.o
pt.64.a drivers/libdrivers.x11.opt.64.a scene/libscene.x11.opt.64.a servers/libservers.x11.opt.64.a core/libcore.x11.opt.64.a modules/freetype/libfreetype_builtin.x11.opt.64.a -lXcursor -lXinerama -lXext -lXrand
r -lXrender -lX11 -lXi -lGL -lpthread -ldl
In member function 'read',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:112:9,
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      | 
In member function 'read',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:112:9,
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      | 
In member function 'read',
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:112:9,
    inlined from 'get_packet' at core/io/packet_peer_udp.cpp:99:0:
./core/ring_buffer.h:68:18: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   68 |     p_buf[dst++] = read[pos + i];
      |                  ^
core/io/packet_peer_udp.cpp: In member function 'get_packet':
core/io/packet_peer_udp.h:52: note: at offset 0 to object 'packet_port' with size 4 declared here
   52 |  int packet_port;
      |

Template 32-bit release

g++ -o bin/godot.x11.opt.tools.32 -flto=64 -pipe -no-pie -m32 -L/usr/lib/i386-linux-gnu -static-libgcc -static-libstdc++ platform/x11/godot_x11.x11.opt.tools.32.o platform/x11/context_gl_x11.x11.opt.tools.32.o p
latform/x11/crash_handler_x11.x11.opt.tools.32.o platform/x11/os_x11.x11.opt.tools.32.o platform/x11/key_mapping_x11.x11.opt.tools.32.o platform/x11/joypad_linux.x11.opt.tools.32.o platform/x11/power_x11.x11.opt
.tools.32.o platform/x11/detect_prime.x11.opt.tools.32.o platform/x11/libudev-so_wrap.x11.opt.tools.32.o -L/root/i686-godot-linux-gnu_sdk-buildroot/i686-godot-linux-gnu/sysroot/usr/lib main/libmain.x11.opt.tools
.32.a main/tests/libtests.x11.opt.tools.32.a modules/libmodules.x11.opt.tools.32.a platform/libplatform.x11.opt.tools.32.a drivers/libdrivers.x11.opt.tools.32.a editor/libeditor.x11.opt.tools.32.a scene/libscene
.x11.opt.tools.32.a servers/libservers.x11.opt.tools.32.a core/libcore.x11.opt.tools.32.a modules/freetype/libfreetype_builtin.x11.opt.tools.32.a -lXcursor -lXinerama -lXext -lXrandr -lXrender -lX11 -lXi -lGL -l
pthread -ldl
g++: WARNING: unsafe header/library path used in cross-compilation: '-L/usr/lib/i386-linux-gnu'
/root/i686-godot-linux-gnu_sdk-buildroot/bin/../lib/gcc/i686-godot-linux-gnu/10.2.0/../../../../i686-godot-linux-gnu/bin/ld: warning: library search path "/usr/lib/i386-linux-gnu" is unsafe for cross-compilation
./thirdparty/minizip/unzip.h:404: warning: type of 'unztell' does not match original declaration [-Wlto-type-mismatch]
  404 | extern z_off_t ZEXPORT unztell OF((unzFile file));
      | 
thirdparty/minizip/unzip.c:1999: note: return value type mismatch
 1999 | extern z_off_t ZEXPORT unztell (unzFile file)
      | 
thirdparty/minizip/unzip.c:1999: note: type 'long int' should match type 'off_t'
thirdparty/minizip/unzip.c:1999: note: 'unztell' was previously declared here
thirdparty/minizip/unzip.c:1999: note: code may be misoptimized unless '-fno-strict-aliasing' is used

Steps to reproduce

Build official builds using scripts from https://github.com/godotengine/godot-build-scripts and containers from https://github.com/godotengine/build-containers

Or possibly simpler steps by just reproducing a single build with similar toolchains and build options.

Minimal reproduction project

No response

akien-mga commented 3 years ago

Some others which I see in latest 3.x branch with GCC 12 with production=yes target=release_debug tools=yes. Raised in bullet, vhacd, and mbedtls.

The bullet and vhacd __builtin_memset warnings have been reported upstream here: https://github.com/bulletphysics/bullet3/discussions/3998

In member function 'resize',
    inlined from 'compute.constprop' at thirdparty/vhacd/src/btConvexHullComputer.cpp:2413:17:
thirdparty/vhacd/inc/btAlignedObjectArray.h:209:17: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  209 |                 new (&m_data[i]) T(fillData);
      |                 ^
thirdparty/vhacd/inc/btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty/vhacd/inc/btAlignedObjectArray.h:111:13: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 64B].m_data' of size [0, 9223372036854775807]
  111 |         if (m_data) {
      |             ^
In member function 'resize',
    inlined from 'compute.constprop' at thirdparty/bullet/LinearMath/btConvexHullComputer.cpp:2676:30:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 32B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'compute.constprop' at thirdparty/bullet/LinearMath/btConvexHullComputer.cpp:2678:14:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 96B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
thirdparty/vhacd/src/VHACD.cpp: In member function 'ComputeBestClippingPlane.constprop':
thirdparty/vhacd/src/VHACD.cpp:703:48: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  703 |     Mesh* chs = new Mesh[2 * m_ompNumProcessors];
      |                                                ^
/usr/include/c++/11/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^
thirdparty/vhacd/src/VHACD.cpp:703:48: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  703 |     Mesh* chs = new Mesh[2 * m_ompNumProcessors];
      |                                                ^
/usr/include/c++/11/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^
In member function 'resize',
    inlined from 'processConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:185:18:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_13(D) + 56B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:186:21:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_13(D) + 88B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:187:23:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_13(D) + 120B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
thirdparty/mbedtls/library/ssl_tls.c: In function 'ssl_calc_finished_tls_sha384':
thirdparty/mbedtls/library/ssl_tls.c:6411:5: warning: 'mbedtls_sha512_finish_ret' accessing 64 bytes in a region of size 48 [-Wstringop-overflow=]
 6411 |     mbedtls_sha512_finish_ret( &sha512, padbuf );
      |     ^
thirdparty/mbedtls/library/ssl_tls.c:6411:5: note: referencing argument 2 of type 'unsigned char *'
thirdparty/mbedtls/library/sha512.c:405:5: note: in a call to function 'mbedtls_sha512_finish_ret'
  405 | int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
      |     ^
In member function 'resize',
    inlined from 'convertBodies' at thirdparty/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp:1366:49:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'convertBodies':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_32(D) + 304B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:118:18,
    inlined from 'solveConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:698:31:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_7 + 56B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:119:21,
    inlined from 'solveConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:698:31:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_7 + 88B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:120:23,
    inlined from 'solveConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:698:31:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_7 + 120B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'buildIslands' at thirdparty/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp:202:25,
    inlined from 'buildAndProcessIslands' at thirdparty/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp:345:14,
    inlined from 'solveConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:702:41:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_16 + 40B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processIslands' at thirdparty/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp:442:25,
    inlined from 'buildAndProcessIslands' at thirdparty/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp:346:19,
    inlined from 'solveConstraints' at thirdparty/bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:702:41:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_16 + 72B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp:261:23:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_44(D) + 48B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp:276:25:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_44(D) + 48B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'collideTVNoStackAlloc' at thirdparty/bullet/BulletCollision/BroadphaseCollision/btDbvt.h:1199:15,
    inlined from 'processCollision' at thirdparty/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp:293:30:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_44(D) + 16B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp:310:23:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_44(D) + 48B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty/bullet/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp:337:25:
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty/bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty/bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'manifoldArray.m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
akien-mga commented 3 years ago

So I looked into this:

thirdparty/mbedtls/library/ssl_tls.c: In function 'ssl_calc_finished_tls_sha384':
thirdparty/mbedtls/library/ssl_tls.c:6411:5: warning: 'mbedtls_sha512_finish_ret' accessing 64 bytes in a region of size 48 [-Wstringop-overflow=]
 6411 |     mbedtls_sha512_finish_ret( &sha512, padbuf );
      |     ^
thirdparty/mbedtls/library/ssl_tls.c:6411:5: note: referencing argument 2 of type 'unsigned char *'
thirdparty/mbedtls/library/sha512.c:405:5: note: in a call to function 'mbedtls_sha512_finish_ret'
  405 | int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
      |     ^

It has been worked around upstream with a #pragma diagnostic ignored: https://github.com/ARMmbed/mbedtls/pull/4498

But that doesn't seem to work with LTO: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80922

So some of the warnings reported above by GCC might be due to this upstream bug, and if so unfixable on our end.