Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104646

[C++20 FTBFS] open62541.h is running afoul of volatile compound statement deprecation in C++20

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.2.6, 6.4.0 RC1, 6.5.0 Beta1
    • 6.4.0 Beta1, 6.5
    • OpcUA
    • None
    • GCC 12, C++20, Ubuntu 20.04
    • 3
    • 891080139d (qt/qtopcua/dev) 1cf8a31969 (qt/qtopcua/6.4) 891080139d (qt/tqtc-qtopcua/dev) d16df83c19 (qt/tqtc-qtopcua/6.2) 0e506badca (qt/qtopcua/6.3) 0e506badca (qt/tqtc-qtopcua/6.3) 1cf8a31969 (qt/tqtc-qtopcua/6.4) 0e506badca (qt/qtopcua/6.3.2)
    • Foundation Sprint 63

    Description

      The file has platform abstractions for atomic operations, with a fall-back to volatile arithmetic, and a GCC 12 ubsan/asan C++20 build indicates that the non-MT branch is in effect. Since the rest of Qt is compiled with MT-support enabled, this probably means things that are assumed to be thread-safe isn't.

      As a more visible outcome the non-MT code-path uses C++20-deprecated volatile arithmetic, and therefor fails to build from source in C++20 mode. If the UA_MULTITHREADING >= 200 code path would be in effect, we wouldn't have this FTBFS.

      Build log excerpt:

      /d/gcc/12/bin/c++ -DQOpen62541Plugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x070000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_OPCUA_LIB -DQT_PLUGIN -DQT_STRICT_QLIST_ITERATORS -DUA_ENABLE_ENCRYPTION -DUA_ENABLE_ENCRYPTION_OPENSSL -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/marc/Qt/qt5-build/qtopcua/src/plugins/opcua/open62541/QOpen62541Plugin_autogen/include -I/home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541 -I/home/marc/Qt/qt5-build/qtopcua/src/plugins/opcua/open62541 -I/home/marc/Qt/qt5-build/qtbase/include -I/home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541 -I/home/marc/Qt/qt5-build/qtbase/include/QtCore -I/home/marc/Qt/qt5-build/qtbase/mkspecs/linux-g++ -I/home/marc/Qt/qt5-build/qtbase/src/corelib -I/home/marc/Qt/qt5-build/qtbase/include/QtCore/6.5.0 -I/home/marc/Qt/qt5-build/qtbase/include/QtCore/6.5.0/QtCore -I/home/marc/Qt/qt5-build/qtbase/include/QtNetwork -I/home/marc/Qt/qt5-build/qtbase/include/QtOpcUa -I/home/marc/Qt/qt5-build/qtopcua/src/opcua -I/home/marc/Qt/qt5-build/qtbase/include/QtOpcUa/6.5.0 -I/home/marc/Qt/qt5-build/qtbase/include/QtOpcUa/6.5.0/QtOpcUa -I/home/marc/Qt/qt5-build/qtbase/src/network -I/home/marc/Qt/qt5-build/qtbase/include/QtNetwork/6.5.0 -I/home/marc/Qt/qt5-build/qtbase/include/QtNetwork/6.5.0/QtNetwork -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=undefined -fsanitize=float-divide-by-zero -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -DNDEBUG -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -fPIC -pthread -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -Wno-error=implicit-fallthrough -Wno-error=deprecated-copy -Wno-error=redundant-move -Wno-error=init-list-lifetime -Wno-error=format-overflow -Wno-error=stringop-overflow -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion -Wsuggest-override -std=c++20 -MD -MT qtopcua/src/plugins/opcua/open62541/CMakeFiles/QOpen62541Plugin.dir/qopen62541backend.cpp.o -MF qtopcua/src/plugins/opcua/open62541/CMakeFiles/QOpen62541Plugin.dir/qopen62541backend.cpp.o.d -o qtopcua/src/plugins/opcua/open62541/CMakeFiles/QOpen62541Plugin.dir/qopen62541backend.cpp.o -c /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/qopen62541backend.cpp
      In file included from /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/qopen62541.h:19,
                       from /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/qopen62541client.h:7,
                       from /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/qopen62541backend.h:4,
                       from /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/qopen62541backend.cpp:4:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h: In function ‘uint32_t UA_atomic_addUInt32(volatile uint32_t*, uint32_t)’:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h:1262:11: error: compound assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]
       1262 |     *addr += increase;
            |     ~~~~~~^~~~~~~~~~~
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h: In function ‘size_t UA_atomic_addSize(volatile size_t*, size_t)’:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h:1276:11: error: compound assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]
       1276 |     *addr += increase;
            |     ~~~~~~^~~~~~~~~~~
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h: In function ‘uint32_t UA_atomic_subUInt32(volatile uint32_t*, uint32_t)’:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h:1290:11: error: compound assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]
       1290 |     *addr -= decrease;
            |     ~~~~~~^~~~~~~~~~~
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h: In function ‘size_t UA_atomic_subSize(volatile size_t*, size_t)’:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h:1304:11: error: compound assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]
       1304 |     *addr -= decrease;
            |     ~~~~~~^~~~~~~~~~~
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h: In function ‘UA_Boolean UA_constantTimeEqual(const void*, const void*, size_t)’:
      /home/marc/Qt/qt5/qtopcua/src/plugins/opcua/open62541/../../../3rdparty/open62541/open62541.h:23418:11: error: compound assignment with ‘volatile’-qualified left operand is deprecated [-Werror=volatile]
      23418 |         c |= x ^ y;
            |         ~~^~~~~~~~
      cc1plus: all warnings being treated as errors
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mmutz Marc Mutz
            mmutz Marc Mutz
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes