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

Build fails due to -Werror=format-truncation in qssgrenderdefaultmaterialshadergenerator.cpp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.10.0 Beta3
    • Quick: 3D
    • None
    • gcc (GCC) 15.2.1 20250813, ccache version 4.11.3, Archlinux
    • 3fc4db53689eeb2ceabc9afe8eeb2eca4d43af87

      Trying to build the current 6.10 branch (737007233) fails with:

      [...]/qt5/qtquick3d/src/runtimerender/qssgrenderdefaultmaterialshadergenerator.cpp: In function ‘void generateMainLightCalculation(QSSGStageGeneratorBase&, QSSGMaterialVertexPipeline&, const QSSGShaderDefaultMaterialKey&, const QSSGRenderGraphObject&, const QSSGShaderLightListView&, QSSGShaderLibraryManager&, QSSGRenderableImage*, bool, bool, bool, bool, bool, bool, bool)’:
      [...]/qt5/qtquick3d/src/runtimerender/qssgrenderdefaultmaterialshadergenerator.cpp:820:43: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
        820 |         std::snprintf(lightIdxStr, 11, "%d", lightIdx);
            |                                           ^
      [...]/qt5/qtquick3d/src/runtimerender/qssgrenderdefaultmaterialshadergenerator.cpp:820:22: note: ‘snprintf’ output between 2 and 12 bytes into a destination of size 11
        820 |         std::snprintf(lightIdxStr, 11, "%d", lightIdx);
            |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      Failing gcc invocation:

      /usr/bin/ccache /usr/lib/ccache/bin/c++ -DQT_ASCII_CAST_WARNINGS -DQT_BUILDING_QT -DQT_BUILD_QUICK3DRUNTIMERENDER_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_GUI_LIB -DQT_MOC_COMPAT -DQT_NETWORK_LIB -DQT_NO_AS_CONST=1 -DQT_NO_CAST_TO_ASCII -DQT_NO_CONTEXTLESS_CONNECT=1 -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_FOREACH=1 -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QASCONST -DQT_NO_QEXCHANGE -DQT_NO_QSNPRINTF -DQT_NO_QSNPRINTF=1 -DQT_NO_STD_FORMAT_SUPPORT -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMETA_LIB -DQT_QMLMODELS_LIB -DQT_QMLWORKERSCRIPT_LIB -DQT_QML_LIB -DQT_QUICK3DUTILS_LIB -DQT_QUICK3D_HAS_LIGHTMAPPER -DQT_QUICK3D_HAS_RUNTIME_SHADERS -DQT_QUICK_LIB -DQT_SHADERTOOLS_LIB -DQT_STRICT_QLIST_ITERATORS -DQT_USE_QSTRINGBUILDER -DQuick3DRuntimeRender_EXPORTS -D_GLIBCXX_ASSERTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/florian/proj/qt/dev6/qt5/qtquick3d/src/runtimerender/Quick3DRuntimeRender_autogen/include -I/home/florian/proj/qt/dev6/qt5/qtbase/include -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DRuntimeRender -I/home/florian/proj/qt/dev6/qt5/qtquick3d/src/runtimerender -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DRuntimeRender/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DRuntimeRender/6.10.0/QtQuick3DRuntimeRender -I/home/florian/proj/qt/dev6/qt5/qtquick3d/src/runtimerender/../3rdparty/tinyexr -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtCore -I/home/florian/proj/qt/dev6/qt5/qtbase/mkspecs/linux-g++ -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtGui -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQml -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlIntegration -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/qmlintegration -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtNetwork -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlMeta -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlModels -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlWorkerScript -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtOpenGL -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DUtils -I/home/florian/proj/qt/dev6/qt5/qtquick3d/src/utils -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DUtils/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick3DUtils/6.10.0/QtQuick3DUtils -I/home/florian/proj/qt/dev6/qt5/qtbase/src/corelib -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtCore/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtCore/6.10.0/QtCore -I/home/florian/proj/qt/dev6/qt5/qtbase/src/gui -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtGui/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtGui/6.10.0/QtGui -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/quick -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQuick/6.10.0/QtQuick -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/qmlmodels -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlModels/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlModels/6.10.0/QtQmlModels -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/qml -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQml/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQml/6.10.0/QtQml -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/qmlmeta -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlMeta/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlMeta/6.10.0/QtQmlMeta -I/home/florian/proj/qt/dev6/qt5/qtdeclarative/src/qmlworkerscript -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlWorkerScript/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtQmlWorkerScript/6.10.0/QtQmlWorkerScript -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtShaderTools -I/home/florian/proj/qt/dev6/qt5/qtshadertools/src/shadertools -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtShaderTools/6.10.0 -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtShaderTools/6.10.0/QtShaderTools -I/home/florian/proj/qt/dev6/qt5/qtbase/include/QtConcurrent -I/home/florian/proj/qt/dev6/qt5/qtquick3d/src/3rdparty/embree/include -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls --param=max-vartrack-size=0 -g -std=gnu++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wno-expansion-to-defined -fPIC -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=stringop-overread -Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated-enum-float-conversion -Wsuggest-override -ftrivial-auto-var-init=pattern -fstack-protector-strong -fstack-clash-protection -fno-exceptions -Winvalid-pch -include /home/florian/proj/qt/dev6/qt5/qtquick3d/src/runtimerender/CMakeFiles/Quick3DRuntimeRender.dir/cmake_pch.hxx -MD -MT qtquick3d/src/runtimerender/CMakeFiles/Quick3DRuntimeRender.dir/qssgrenderdefaultmaterialshadergenerator.cpp.o -MF qtquick3d/src/runtimerender/CMakeFiles/Quick3DRuntimeRender.dir/qssgrenderdefaultmaterialshadergenerator.cpp.o.d -o qtquick3d/src/runtimerender/CMakeFiles/Quick3DRuntimeRender.dir/qssgrenderdefaultmaterialshadergenerator.cpp.o -c /home/florian/proj/qt/dev6/qt5/qtquick3d/src/runtimerender/qssgrenderdefaultmaterialshadergenerator.cpp
      

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

            qt.team.graphics.and.multimedia Qt Graphics Team
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes