[x265] A few warnings from GCC 4.8.2

Steve Borho steve at borho.org
Wed Jul 16 09:19:15 CEST 2014


On Sun, Jul 13, 2014 at 4:33 PM, Mario Rohkrämer <contact at ligh.de> wrote:
> level.cpp
> +----
> h:/MSYS/home/LigH/x265/source/encoder/level.cpp: In function 'void
> x265::determineLevel(const x265_param&, x265::Profile::Name&,
> x265::Level::Name&, x265::Level::Tier&)':
> h:/MSYS/home/LigH/x265/source/encoder/level.cpp:143:24: warning: array
> subscript is above array bounds [-Warray-bounds]
>          while (levels[i].levelIdc < param.levelIdc && levels[i].levelIdc)
>                         ^
> h:/MSYS/home/LigH/x265/source/encoder/level.cpp:143:24: warning: array
> subscript is above array bounds [-Warray-bounds]
> +----

I have a patch for this; gcc took quite some convincing that the loop
bounds were correct.  I'll push it tomorrow after some testing.

> ratecontrol.cpp
> +----
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp: In member function
> 'bool x265::RateControl::initPass2()':
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning:
> 'minVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
>  bool RateControl::initPass2()
>       ^
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning:
> 'maxVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning: 'a'
> may be used uninitialized in this function [-Wmaybe-uninitialized]
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning:
> 'minVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning:
> 'maxVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
> h:/MSYS/home/LigH/x265/source/encoder/ratecontrol.cpp:731:6: warning: 'a'
> may be used uninitialized in this function [-Wmaybe-uninitialized]
> +----

These I've tracked to the CLIP_DURATION() macros which map to Clip3(
MIN, MAX, f ) where MIN and MAX are constant floats.  I haven't the
slightest clue why GCC thinks the minVal/maxVal arguments might be
uninitialized, when they are constants: 0.01 and 1.00.

This is gcc 4.8.1.  Older versions of gcc don't seem to complain about it.

--
Steve Borho


More information about the x265-devel mailing list