Ubuntu 22.04 compiler warnings

Discuss anything related to product development
Post Reply
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Ubuntu 22.04 compiler warnings

Post by seasoned_geek »

Here's a sample from Ubuntu 22.04

Ubuntu 22.04 compile issues

developer@roland-u22-04-VirtualBox:~/Projects$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

developer@roland-u22-04-VirtualBox:~/Projects$ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.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.



Code: Select all

    inlined from ‘bool std::equal(_II1, _II1, _II2, _II2) [with _II1 = __gnu_cxx::__normal_iterator<const unsigned char*, std::vector<unsigned char> >; _II2 = __gnu_cxx::__normal_iterator<const unsigned char*, std::vector<unsigned char> >]’ at /usr/include/c++/11/bits/stl_algobase.h:1678:38,
    inlined from ‘bool CsString::operator==(const CsString_utf8&, const CsString_utf8&)’ at /home/developer/Projects/cs_build/include/QtCore/cs_string.h:3489:21,
    inlined from ‘QTextCodec* createForMib(int)’ at /home/developer/Projects/copperspice/src/core/codecs/qtextcodec.cpp:165:16,
    inlined from ‘static QTextCodec* QTextCodec::codecForMib(int)’ at /home/developer/Projects/copperspice/src/core/codecs/qtextcodec.cpp:692:24:
/usr/include/c++/11/bits/stl_algobase.h:105:32: warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overread]
  105 |         return __builtin_memcmp(__first1, __first2, sizeof(_Tp) * __num);

      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/algorithm:61,
                 from /home/developer/Projects/copperspice/src/core/global/qglobal.h:45,
                 from /home/developer/Projects/copperspice/src/core/global/qplatformdefs.h:27,
                 from /home/developer/Projects/copperspice/src/core/codecs/qtextcodec.cpp:24:
/usr/include/c++/11/bits/stl_iterator.h: In static member function ‘static QTextCodec* QTextCodec::codecForMib(int)’:
/usr/include/c++/11/bits/stl_iterator.h:1011:9: note: source object allocated here
 1011 |       : _M_current(__i) { }
      |         ^~~~~~~~~~~~~~~

	  
	  
	  

[148/3841] Building CXX object src/core/CMakeFiles/CsCore.dir/plugin/quuid.cpp.o
In function ‘void _q_uuidToHex(T*&, const uint&, const ushort&, const ushort&, const uchar (&)[8]) [with T = char]’,
    inlined from ‘QByteArray QUuid::toByteArray() const’ at /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:250:16:
/home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:103:11: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  103 |    *dst++ = T('-');
      |    ~~~~~~~^~~~~~~~
In file included from /home/developer/Projects/copperspice/src/core/tools/qbytearray.h:34,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring8.h:32,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring.h:1,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.h:27,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:24:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h: In member function ‘QByteArray QUuid::toByteArray() const’:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
  103 | struct QTypedArrayData : QArrayData {
      |        ^~~~~~~~~~~~~~~
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
In function ‘void _q_uuidToHex(T*&, const uint&, const ushort&, const ushort&, const uchar (&)[8]) [with T = char]’,
    inlined from ‘QByteArray QUuid::toByteArray() const’ at /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:250:16:
/home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:109:9: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  109 |    *dst = T('}');
      |    ~~~~~^~~~~~~~
In file included from /home/developer/Projects/copperspice/src/core/tools/qbytearray.h:34,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring8.h:32,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring.h:1,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.h:27,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:24:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h: In member function ‘QByteArray QUuid::toByteArray() const’:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset [37, 52] into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
  103 | struct QTypedArrayData : QArrayData {
      |        ^~~~~~~~~~~~~~~
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset [37, 52] into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset [37, 52] into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset [37, 52] into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24



[148/3841] Building CXX object src/core/CMakeFiles/CsCore.dir/plugin/quuid.cpp.o
In function ‘void _q_uuidToHex(T*&, const uint&, const ushort&, const ushort&, const uchar (&)[8]) [with T = char]’,
    inlined from ‘QByteArray QUuid::toByteArray() const’ at /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:250:16:
/home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:103:11: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  103 |    *dst++ = T('-');
      |    ~~~~~~~^~~~~~~~
In file included from /home/developer/Projects/copperspice/src/core/tools/qbytearray.h:34,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring8.h:32,
                 from /home/developer/Projects/cs_build/include/QtCore/qstring.h:1,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.h:27,
                 from /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:24:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h: In member function ‘QByteArray QUuid::toByteArray() const’:
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
  103 | struct QTypedArrayData : QArrayData {
      |        ^~~~~~~~~~~~~~~
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
/home/developer/Projects/copperspice/src/core/tools/qarraydata.h:103:8: note: at offset 24 into destination object ‘QTypedArrayData<char>::<anonymous>’ of size 24
In function ‘void _q_uuidToHex(T*&, const uint&, const ushort&, const ushort&, const uchar (&)[8]) [with T = char]’,
    inlined from ‘QByteArray QUuid::toByteArray() const’ at /home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:250:16:
/home/developer/Projects/copperspice/src/core/plugin/quuid.cpp:109:9: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  109 |    *dst = T('}');
      |    ~~~~~^~~~~~~~
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Ubuntu 22.04 compiler warnings

Post by barbara »

We have not added Ubuntu 22.04 to CI so this is currently an unsupported OS. We will be adding it in June and will address any issues at that time.

Barbara
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: Ubuntu 22.04 compiler warnings

Post by seasoned_geek »

Building from the tip of tip today on Ubuntu 22.04 LTS with all updates applied.

Code: Select all

    inlined from ‘static QTextCodec* QTextCodec::codecForMib(int)’ at /home/developer/Projects/copperspice/src/core/codecs/qtextcodec.cpp:692:24:
/usr/include/c++/11/bits/stl_algobase.h:105:32: warning: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’ specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overread]
  105 |         return __builtin_memcmp(__first1, __first2, sizeof(_Tp) * __num);
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/algorithm:61,
                 from /home/developer/Projects/copperspice/src/core/global/qglobal.h:45,
                 from /home/developer/Projects/copperspice/src/core/global/qplatformdefs.h:27,
                 from /home/developer/Projects/copperspice/src/core/codecs/qtextcodec.cpp:24:
/usr/include/c++/11/bits/stl_iterator.h: In static member function ‘static QTextCodec* QTextCodec::codecForMib(int)’:
/usr/include/c++/11/bits/stl_iterator.h:1011:9: note: source object allocated here
 1011 |       : _M_current(__i) { }
      |         ^~~~~~~~~~~~~~~
I assume the June target for U22.04 support got pushed back. Do we have a new date?
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Ubuntu 22.04 compiler warnings

Post by barbara »

We added Ubuntu 22.04 to our internal CI in July.

We are set to push some commits which will resolve various warnings in the next week. A new binary update for CopperSpice is scheduled when the new CsVulkan development branch is merged this month.

Barbara
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Ubuntu 22.04 compiler warnings

Post by barbara »

Thought it would be a good idea to add a bit more information. The situation with some of the warnings are actually known false positives in GCC 11. These warnings can not be resolved in a user application.

(1) We found a "-Wformat-overflow" in a call to qWarning() in the XCB plugin. This condition can never happen since QString::constData() can not return a nullptr.

(2) The "-Wstringop-overread" in the memcmp is also a false positive since the implementation of the standard library is passing a value for the size which is too large.
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: Ubuntu 22.04 compiler warnings

Post by seasoned_geek »

barbara wrote: Mon Sep 05 2022 10:44 pm Thought it would be a good idea to add a bit more information. The situation with some of the warnings are actually known false positives in GCC 11. These warnings can not be resolved in a user application.

(1) We found a "-Wformat-overflow" in a call to qWarning() in the XCB plugin. This condition can never happen since QString::constData() can not return a nullptr.

(2) The "-Wstringop-overread" in the memcmp is also a false positive since the implementation of the standard library is passing a value for the size which is too large.
While that is all well and good, the regulated environments I and many others work in require zero warnings when building. The paperwork and living Hell one must go through to get a warning turned off can be unbelievable. While these may be explainable, their existence will significantly limit the adoption of the library.

I look forward to the reduced warning version when it is pushed.
barbara
Posts: 446
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Ubuntu 22.04 compiler warnings

Post by barbara »

Thanks for the reminder, we pushed the changes which are in our control the other day. The team will continue to investigate if others can be resolved.

Barbara
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: Ubuntu 22.04 compiler warnings

Post by seasoned_geek »

barbara wrote: Fri Sep 09 2022 5:59 pm Thanks for the reminder, we pushed the changes which are in our control the other day. The team will continue to investigate if others can be resolved.

Barbara
Building in 22.04 this morning from fresh pull. Just pasting here so we don't forget to clean up CMake issues as well.

Code: Select all

-- Could NOT find Cups (missing: CUPS_LIBRARIES CUPS_INCLUDE_DIR) 
-- Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR) 
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (PulseAudio).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  cmake/modules/FindPulseAudio.cmake:33 (include)
  CMakeLists.txt:299 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find PulseAudio (missing: PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR) (Required is at least version "0.9.9")
-- PostgreSQL was not found, CopperSpice plugin will not be built

-- MySQL was not found, CopperSpice plugin will not be built

CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (GLib2).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  cmake/modules/FindGLib2.cmake:34 (include)
  CMakeLists.txt:407 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GOBJECT2)
  does not match the name of the calling package (GObject2).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/modules/FindGObject2.cmake:60 (find_package_handle_standard_args)
  CMakeLists.txt:415 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (PkgConfig)
  does not match the name of the calling package (Fontconfig).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:99 (find_package_handle_standard_args)
  cmake/modules/FindFontconfig.cmake:33 (include)
  CMakeLists.txt:473 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) 
It looks like most of the CMake warnings are gone though so that is a major improvement. Keep up the good work!
seasoned_geek
Posts: 253
Joined: Thu Jun 11 2020 12:18 pm

Re: Ubuntu 22.04 compiler warnings

Post by seasoned_geek »

In case this wasn't included in the last batch, this seems to come up a lot today.

Code: Select all

In destructor ‘WebCore::TreeShared<T>::~TreeShared() [with T = WebCore::ContainerNode]’,
    inlined from ‘void WebCore::TreeShared<T>::removedLastRef() [with T = WebCore::ContainerNode]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/platform/TreeShared.h:118:9,
    inlined from ‘void WebCore::TreeShared<T>::deref() [with T = WebCore::ContainerNode]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/platform/TreeShared.h:79:27,
    inlined from ‘void WebCore::TreeShared<T>::deref() [with T = WebCore::ContainerNode]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/platform/TreeShared.h:68:10,
    inlined from ‘void WTF::derefIfNotNull(T*) [with T = WebCore::HTMLFormElement]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h:59:23,
    inlined from ‘WTF::RefPtr<T>::~RefPtr() [with T = WebCore::HTMLFormElement]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefPtr.h:58:49,
    inlined from ‘WebCore::FormState::~FormState()’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/loader/FormState.h:46:11,
    inlined from ‘void WTF::RefCounted<T>::deref() [with T = WebCore::FormState]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h:141:13,
    inlined from ‘void WTF::RefCounted<T>::deref() [with T = WebCore::FormState]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/RefCounted.h:138:10,
    inlined from ‘void WTF::derefIfNotNull(T*) [with T = WebCore::FormState]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h:59:23,
    inlined from ‘WTF::PassRefPtr<T>::~PassRefPtr() [with T = WebCore::FormState]’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/JavaScriptCore/wtf/PassRefPtr.h:74:53,
    inlined from ‘void WebCore::PolicyChecker::checkNavigationPolicy(const WebCore::ResourceRequest&, WebCore::DocumentLoader*, WTF::PassRefPtr<WebCore::FormState>, WebCore::NavigationPolicyDecisionFunction, void*)’ at /home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/loader/PolicyChecker.cpp:68:17:
/home/developer/Projects/copperspice/src/3rdparty/webkit/Source/WebCore/platform/TreeShared.h:57:5: warning: ‘void operator delete(void*, std::size_t)’ called on pointer ‘((WTF::RefPtr<WebCore::HTMLFormElement>*)D.402095.m_ptr)[1].WTF::RefPtr<WebCore::HTMLFormElement>::m_ptr’ with nonzero offset 8 [-Wfree-nonheap-object]
   57 |     }
      |     ^
Post Reply