fraunhoferhhi/vvdec

Fail to build for powerpc

Closed this issue · 2 comments

powerpc Debian unstable gcc 10.2.1

FAILED: source/Lib/vvdec/CMakeFiles/vvdec.dir/__/CommonLib/UnitTools.cpp.o 
c++ -DVVDEC_SOURCE -Dvvdec_EXPORTS -I../source/Lib/vvdec/../../../include -I. -I../source/Lib/vvdec/SYSTEM -I../source/Lib/vvdec/. -I../source/Lib/vvdec/.. -I../source/Lib/vvdec/../DecoderLib -I../source/Lib/vvdec/../CommonLib -I../source/Lib/vvdec/../CommonLib/x86 -I../source/Lib/vvdec/../libmd5 -g -O2 -ffile-prefix-map=/home/marillat/vvdec-dmo-1.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -fPIC -Wall -Werror -Wno-unused-function -Wno-sign-compare -fdiagnostics-show-option -Wno-ignored-attributes -std=gnu++14 -MD -MT source/Lib/vvdec/CMakeFiles/vvdec.dir/__/CommonLib/UnitTools.cpp.o -MF source/Lib/vvdec/CMakeFiles/vvdec.dir/__/CommonLib/UnitTools.cpp.o.d -o source/Lib/vvdec/CMakeFiles/vvdec.dir/__/CommonLib/UnitTools.cpp.o -c ../source/Lib/CommonLib/UnitTools.cpp
../source/Lib/CommonLib/UnitTools.cpp: In function ‘void vvdec::PU::getInterMergeCandidates(const PredictionUnit&, vvdec::MergeCtx&, vvdec::MotionHist&, const int&)’:
../source/Lib/CommonLib/UnitTools.cpp:1246:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 1246 |     mrgCtx.interDirNeighbours [uiArrayAddr     ] = 1;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from ../source/Lib/CommonLib/UnitTools.h:55,
                 from ../source/Lib/CommonLib/UnitTools.cpp:51:
../source/Lib/CommonLib/ContextModelling.h:468:17: note: at offset 6 to object ‘vvdec::MergeCtx::interDirNeighbours’ with size 6 declared here
  468 |   unsigned char interDirNeighbours[ MRG_MAX_NUM_CANDS      ];
      |                 ^~~~~~~~~~~~~~~~~~
../source/Lib/CommonLib/UnitTools.cpp:1247:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 1247 |     mrgCtx.BcwIdx             [uiArrayAddr     ] = BCW_DEFAULT;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from ../source/Lib/CommonLib/UnitTools.h:55,
                 from ../source/Lib/CommonLib/UnitTools.cpp:51:
../source/Lib/CommonLib/ContextModelling.h:467:17: note: at offset 6 to object ‘vvdec::MergeCtx::BcwIdx’ with size 6 declared here
  467 |   uint8_t       BcwIdx            [ MRG_MAX_NUM_CANDS      ];
      |                 ^~~~~~
../source/Lib/CommonLib/UnitTools.cpp:1253:58: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
 1253 |       mrgCtx.interDirNeighbours [ uiArrayAddr          ] = 3;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from ../source/Lib/CommonLib/UnitTools.h:55,
                 from ../source/Lib/CommonLib/UnitTools.cpp:51:
../source/Lib/CommonLib/ContextModelling.h:468:17: note: at offset 6 to object ‘vvdec::MergeCtx::interDirNeighbours’ with size 6 declared here
  468 |   unsigned char interDirNeighbours[ MRG_MAX_NUM_CANDS      ];
      |                 ^~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors```
K-os commented

That looks like a bug in the static analyzer of the specific GCC version you are using. If you look at the code two lines above the first error, there is a loop condition to check that uiArrayAddr doesn't exceed the MRG_MAX_NUM_CANDS range:

  while (uiArrayAddr < maxNumMergeCand && uiArrayAddr < MRG_MAX_NUM_CANDS)
  {
    mrgCtx.interDirNeighbours [uiArrayAddr     ] = 1;
    mrgCtx.BcwIdx             [uiArrayAddr     ] = BCW_DEFAULT;
    mrgCtx.mvFieldNeighbours  [uiArrayAddr << 1] . setMvField(Mv(0, 0), r);
    mrgCtx.useAltHpelIf       [uiArrayAddr     ] = false;

You can work around the issue by adding -Wno-error=stringop-overflow to the compiler-flags in source/Lib/vvdec/CMakeLists.txt line 100.

I agree the gcc version is old. I already did a build by removing -Werror from compiler flags
You can close this bug. I'll report this bug to GCC if I see again this problem with never GCC.