[FFmpeg-devel] [PATCH] [RFC] fix 'may be used uninitialized' warnings
Patrik Kullman
patrik
Wed Feb 11 14:48:53 CET 2009
On Wed, 2009-02-11 at 14:03 +0100, Diego Biurrun wrote:
> On Wed, Feb 11, 2009 at 01:23:14PM +0100, Diego Biurrun wrote:
> > On Mon, Feb 02, 2009 at 04:02:42PM +0100, Michael Niedermayer wrote:
> > > On Mon, Feb 02, 2009 at 12:59:19PM +0100, Diego Biurrun wrote:
> > > > On Mon, Feb 02, 2009 at 12:49:43PM +0100, Michael Niedermayer wrote:
> > > > > On Mon, Feb 02, 2009 at 11:43:16AM +0100, Diego Biurrun wrote:
> > > > > > Here is a patch to fix all but one 'may be used initialized' warning
> > > > > > in FFmpeg. Regression tests pass, so this cannot have broken things
> > > > > > too badly, but some of it may nonetheless be suspicious.
> > > > > >
> > > > > > Please review, I will commit individual hunks as they get approved,
> > > > > > not before.
> > > > > >
> > > > > > --- libavcodec/eatgv.c (revision 16938)
> > > > > > +++ libavcodec/eatgv.c (working copy)
> > > > > > @@ -63,7 +63,7 @@
> > > > > > unsigned char *dst_end = dst + width*height;
> > > > > > - int size,size1,size2,offset,run;
> > > > > > + int size, size1, size2, offset = 0, run;
> > > > > > unsigned char *dst_start = dst;
> > > > >
> > > > > very obviously false positive, it can never be read without prior init
> > > >
> > > > What about all those falso positives? Are those hunks OK to commit?
> > >
> > > no
> > > IMHO if a warning is wrong it should be fixed without changing the generated
> > > code. Of course there may be desireable changes in the code that might
> > > remove a warning as a sideeffect but adding =0 is not.
> > > If theres a =0 then the reader thinks it IS used which can in principle
> > > lead to confusion.
> >
> > Is it OK to mark the false positives with av_uninit()?
>
> Here is a patch that does this.
For lpc.c, you need to make sure use_lpc > 0 before using av_uninit();
There is a thread about this - "[PATCH] libavcodec/lpc.c: Fix warning
about uninitialized variable"
Also, I submitted an identical patch for electronicarts.c a couple of
days ago - "[PATCH] libavformat/electronicarts.c: Fix warning about
uninitialized variable"
> Diego
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list