Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-30540

Compiler warning about out of bounds array access

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 11.0.3, Qt Creator 13.0.0-rc1
    • QML Profiler
    • None
    • Ubuntu 22.04 LTS
      g++ 11.4.0
      Qt 6.6.0, Qt 6.7.0rc

    Description

      1. Have sources of Qt Creator.
        I used a checkout of git branch 13.0, revision cdad61d08a8ef3f02cdc3b11275b4dee461b9e8f.
      2. Build these sources.
        I used:
        qt-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DWITH_DOCS=ON -DQTC_FORCE_XCB=ON -S ~/dev/src/creator-13/
        

        The compiler warns about an out of bounds index:

        [1258/1602] Building CXX object s...ofiler.dir/inputeventsmodel.cpp.o
        In file included from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilermodelmanager.h:9,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h:7,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/inputeventsmodel.h:6,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/inputeventsmodel.cpp:4:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h: In member function ‘virtual void QmlProfiler::Internal::InputEventsModel::loadEvent(const QmlProfiler::QmlEvent&, const QmlProfiler::QmlEventType&)’:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        [1261/1602] Building CXX object s...ofiler.dir/pixmapcachemodel.cpp.o
        In file included from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilermodelmanager.h:9,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h:7,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/pixmapcachemodel.h:6,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/pixmapcachemodel.cpp:4:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h: In member function ‘virtual void QmlProfiler::Internal::PixmapCacheModel::loadEvent(const QmlProfiler::QmlEvent&, const QmlProfiler::QmlEventType&)’:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        [1263/1602] Building CXX object s.../qmlprofileranimationsmodel.cpp.o
        In file included from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilermodelmanager.h:9,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilertimelinemodel.h:7,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofileranimationsmodel.h:6,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp:4:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h: In member function ‘virtual void QmlProfiler::Internal::QmlProfilerAnimationsModel::loadEvent(const QmlProfiler::QmlEvent&, const QmlProfiler::QmlEventType&)’:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        [1278/1602] Building CXX object s...dir/scenegraphtimelinemodel.cpp.o
        In file included from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlprofilermodelmanager.h:9,
                         from /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp:5:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h: In member function ‘virtual void QmlProfiler::Internal::SceneGraphTimelineModel::loadEvent(const QmlProfiler::QmlEvent&, const QmlProfiler::QmlEventType&)’:
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 4 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:97:42: warning: array subscript 4 is above array bounds of ‘const qint16 [4]’ {aka ‘const short int [4]’} [-Warray-bounds]
           97 |             return m_data.internal16bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:206:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal16bit’
          206 |         qint16 internal16bit[s_internalDataLength / 2];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 4 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:97:42: warning: array subscript 4 is above array bounds of ‘const qint16 [4]’ {aka ‘const short int [4]’} [-Warray-bounds]
           97 |             return m_data.internal16bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:206:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal16bit’
          206 |         qint16 internal16bit[s_internalDataLength / 2];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 2 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:99:42: warning: array subscript 3 is above array bounds of ‘const qint32 [2]’ {aka ‘const int [2]’} [-Warray-bounds]
           99 |             return m_data.internal32bit[i];
              |                    ~~~~~~~~~~~~~~~~~~~~~~^
        /home/qtrob/dev/src/creator-13/src/plugins/qmlprofiler/qmlevent.h:207:16: note: while referencing ‘QmlProfiler::QmlEvent::<unnamed union>::internal32bit’
          207 |         qint32 internal32bit[s_internalDataLength / 4];
              |                ^~~~~~~~~~~~~
        

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes