canonical / wlcs

Wayland Conformance Test Suite
GNU General Public License v2.0
50 stars 14 forks source link

1.4.0: LTO exposes new type of warnings #227

Open kloczek opened 2 years ago

kloczek commented 2 years ago

Looks like LTO exposes new type of warnings:

[ 99%] Linking CXX executable wlcs.ubsan
/usr/bin/cmake -E cmake_link_script CMakeFiles/wlcs.ubsan.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -pthread -g -Werror -Wall -fno-strict-aliasing -pedantic -Wnon-virtual-dtor -Wextra -fPIC -DNDEBUG -Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -fsanitize=undefined CMakeFiles/wlcs.ubsan.dir/src/data_device.cpp.o CMakeFiles/wlcs.ubsan.dir/src/gtk_primary_selection.cpp.o CMakeFiles/wlcs.ubsan.dir/src/helpers.cpp.o CMakeFiles/wlcs.ubsan.dir/src/in_process_server.cpp.o CMakeFiles/wlcs.ubsan.dir/src/xdg_shell_v6.cpp.o CMakeFiles/wlcs.ubsan.dir/src/xdg_shell_stable.cpp.o CMakeFiles/wlcs.ubsan.dir/src/layer_shell_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/src/main.cpp.o CMakeFiles/wlcs.ubsan.dir/src/pointer_constraints_unstable_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/src/primary_selection.cpp.o CMakeFiles/wlcs.ubsan.dir/src/shared_library.cpp.o CMakeFiles/wlcs.ubsan.dir/src/relative_pointer_unstable_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/src/xfail_supporting_test_listener.cpp.o CMakeFiles/wlcs.ubsan.dir/src/xdg_output_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/src/version_specifier.cpp.o CMakeFiles/wlcs.ubsan.dir/src/surface_builder.cpp.o CMakeFiles/wlcs.ubsan.dir/src/input_method.cpp.o CMakeFiles/wlcs.ubsan.dir/generated/gtk-primary-selection.c.o CMakeFiles/wlcs.ubsan.dir/generated/primary-selection-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/wayland.c.o CMakeFiles/wlcs.ubsan.dir/generated/xdg-shell-unstable-v6.c.o CMakeFiles/wlcs.ubsan.dir/generated/xdg-shell.c.o CMakeFiles/wlcs.ubsan.dir/generated/wlr-layer-shell-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/xdg-output-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/wlr-foreign-toplevel-management-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/pointer-constraints-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/relative-pointer-unstable-v1.c.o CMakeFiles/wlcs.ubsan.dir/generated/text-input-unstable-v3.c.o CMakeFiles/wlcs.ubsan.dir/generated/input-method-unstable-v2.c.o CMakeFiles/wlcs.ubsan.dir/tests/test_bad_buffer.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/pointer_constraints.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/copy_cut_paste.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/gtk_primary_selection.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/test_surface_events.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/touches.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/wl_output.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/surface_input_regions.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/frame_submission.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/primary_selection.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/relative_pointer.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/subsurfaces.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_surface_v6.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_toplevel_v6.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_surface_stable.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_toplevel_stable.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_popup.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/wlr_layer_shell_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/xdg_output_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/wlr_foreign_toplevel_management_v1.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/self_test.cpp.o CMakeFiles/wlcs.ubsan.dir/tests/text_input_v3_with_input_method_v2.cpp.o -o wlcs.ubsan  -lubsan -L/usr/lib64 -lwayland-client -lwayland-client -L/usr/lib64 -lwayland-server -lwayland-client -ldl /usr/lib64/libgmock.so.1.11.0 /usr/lib64/libgtest.so.1.11.0 -lwayland-server -ldl
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/x86_64-redhat-linux-gnu'
[ 99%] Built target wlcs
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/x86_64-redhat-linux-gnu'
[ 99%] Built target wlcs.tsan
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/x86_64-redhat-linux-gnu'
[ 99%] Built target wlcs.asan
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_enter' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/include/mock_text_input_v3.h:47:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp:82:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1612819].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp:82: note: '<anonymous>' declared here
   82 |     EXPECT_CALL(text_input, enter(_)).Times(0);
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_data_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:84:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:166:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1708296].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:166: note: '<anonymous>' declared here
  166 |     EXPECT_CALL(device_listener, data_offer(_, _))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_data_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:84:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:166:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1708297].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:166: note: '<anonymous>' declared here
  166 |     EXPECT_CALL(device_listener, data_offer(_, _))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:92:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:169:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1708304].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:169: note: '<anonymous>' declared here
  169 |     EXPECT_CALL(offer_listener, offer(_, StrEq(any_mime_type)));
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_data_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:84:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:166:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1723591].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:166: note: '<anonymous>' declared here
  166 |     EXPECT_CALL(device_listener, data_offer(_, _))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_data_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:84:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:166:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1723592].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:166: note: '<anonymous>' declared here
  166 |     EXPECT_CALL(device_listener, data_offer(_, _))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_offer' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:92:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:169:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.1723599].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:169: note: '<anonymous>' declared here
  169 |     EXPECT_CALL(offer_listener, offer(_, StrEq(any_mime_type)));
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_enter' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/include/mock_text_input_v3.h:47:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp:72:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.2568709].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/text_input_v3_with_input_method_v2.cpp:72: note: '<anonymous>' declared here
   72 |     EXPECT_CALL(text_input, enter(_))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_send' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:99:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:203:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.3074569].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/primary_selection.cpp:203: note: '<anonymous>' declared here
  203 |     EXPECT_CALL(source_listener, send(_, _, _))
      |
In member function '__ct ',
    inlined from '__ct ' at /usr/include/gtest/gtest-matchers.h:479:0,
    inlined from 'gmock_send' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:99:0,
    inlined from 'TestBody' at /home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:203:0:
/usr/include/gtest/gtest-matchers.h:302: error: 'MEM[(const struct MatcherBase *)&D.3166869].buffer_' may be used uninitialized [-Werror=maybe-uninitialized]
  302 |       : vtable_(other.vtable_), buffer_(other.buffer_) {
      |
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp: In member function 'TestBody':
/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/tests/gtk_primary_selection.cpp:203: note: '<anonymous>' declared here
  203 |     EXPECT_CALL(source_listener, send(_, _, _))
      |
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/wlcs.ubsan.dir/build.make:998: wlcs.ubsan] Error 1
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/x86_64-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:225: CMakeFiles/wlcs.ubsan.dir/all] Error 2
gmake[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/wlcs-1.4.0/x86_64-redhat-linux-gnu'
gmake: *** [Makefile:139: all] Error 2
AlanGriffiths commented 2 years ago

@kloczek we don't see those errors on the systems we use. What's your build environment? (g++ version, gmock version etc.)

kloczek commented 2 years ago

Please use LTO options to expose those warnings.