[x265] GCC 4.8.2 warning in slicetype.cpp (aggr. loop opt.) 64b HBD only

Steve Borho steve at borho.org
Wed Feb 25 18:01:09 CET 2015


On 02/25, Steve Borho wrote:
> On 02/25, Mario *LigH* Rohkr??mer wrote:
> > Only while compiling for x86-64 with HIGH_BIT_DEPTH:
> > 
> > +----
> > h:/MSYS/home/Entwicklung/x265/source/encoder/slicetype.cpp: In
> > member function 'void
> > x265::LookaheadTLD::lowresIntraEstimate(x265::Lowres&)':
> > h:/MSYS/home/Entwicklung/x265/source/encoder/slicetype.cpp:262:135:
> > warning: iteration 17u invokes undefined behavior
> > [-Waggressive-loop-optimizations]
> >                    neighbours[1][i]           = (neighbours[0][i -
> > 1]           + (neighbours[0][i] << 1)           + neighbours[0][i +
> > 1]      + 2) >> 2;
> >                                                                                                                                          ^
> > cc1plus.exe: note: containing loop
> 
> This looks like a valid warning, reviewing the intra sample code for
> lookahead now.

The loop bounds are 1..15 so I do not understand why the compiler is
complaining about iteration 17u.  If I double the size of the neighbors
buffer, it complains about iteration 33u, which is just silly. I think
gcc is just confused about the outer loops.

http://stackoverflow.com/questions/24296571/why-does-this-loop-produce-warning-iteration-3u-invokes-undefined-behavior-an

interestingly, GCC 4.9 does not generate this warning, so I am not sure
what the best course of action here. Is GCC 4.8 warning about a bug in
the code their (broken) aggressive loop optimizations are generating, or
is the warning simply bogus?

-- 
Steve Borho


More information about the x265-devel mailing list