[FFmpeg-devel] [PATCH] make sure initialization happens even after goto fires

Michael Niedermayer michaelni
Thu Jul 17 21:34:24 CEST 2008


On Thu, Jul 17, 2008 at 08:39:00PM +0200, Reimar D?ffinger wrote:
> On Thu, Jul 17, 2008 at 11:12:04AM -0700, Erik Hovland wrote:
> > On Thu, Jul 17, 2008 at 07:03:43PM +0200, Michael Niedermayer wrote:
> > > On Thu, Jul 17, 2008 at 09:08:40AM -0700, Erik Hovland wrote:
> > > > The goto in ff_h264_find_frame_end() is inside an else clause. The
> > > > initialization for v happens in the if clause elsewhere. That means that
> > > > it is possible for the goto to fire without the initialization of v
> > > > happening. Normally this isn't a problem. But gcc recognizes this and
> > > > throws an internal parse warning. It then has to go through a special
> > > > code branch to take care of this. If the initialization of v always
> > > > happens before either clause this does not happen. The attached patch
> > > > does just that.
> > > 
> > > Is there any bug in our code?
> > 
> > Well, that is an interesting question. It would be a bug if the goto
> > fired without v being initialized. Which is possible, but highly
> > unlikely.
> 
> Why, v is not used so why should it be wrong if it is not initialized?
> Still, I do think the code would look nicer if it was done like in
> attached patch, though the remaining code is sufficient to make the
> average programmer's head explode on first sight anyway ;-)

Ive no objection to the patch

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I wish the Xiph folks would stop pretending they've got something they
do not.  Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080717/8db24bb3/attachment.pgp>



More information about the ffmpeg-devel mailing list