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

Erik Hovland erik
Thu Jul 17 21:14:06 CEST 2008

On Thu, Jul 17, 2008 at 07:41:30PM +0100, M?ns Rullg?rd wrote:
> >> The gcc internals are irrelevant.  Only two things matter: 1) whether
> >> it is valid C code, and 2) whether gcc issues a warning.  As far as
> >> I can tell, it is valid C.  The question is thus, does it trigger a
> >> warning with gcc?

The gcc internals are relevant if they expose dodgy code. Any compiler
is likely to have trouble parsing this code internally, BTW.

> > It triggers a warning with gcc that the user never sees.
> In that case there is no warning.

If a tree falls in the forest and no one sees it, does it make any
noise? According to your statement, it doesn't.

> > I do agree. It is valid C. But it is playing a bit loose with its
> > validity.
> Code is either valid or not.  There are no states in between.  This
> code clearly falls in the valid category.

Code can have valid syntax but be invalid. This is why there are bugs.

> > A static analysis tool can see the warning because it can see what gcc
> > emits.
> You mean a gcc-based static analysis tool, which is something I
> wouldn't put a lot of faith in.

The checker is coverity prevent.

> > But hey, the reason I post these patches is to get this kind of
> > feedback.
> Perhaps you could have been clearer about this.  From your mail, it
> was impossible to tell whether there was an actual bug, a compiler
> warning (the kind that gets printed), or something else.

It is very hard to tell if this would ever trigger a real bug. But it is
possible. With the patch, it is impossible.


Erik Hovland
mail: erik at hovland.org
web: http://hovland.org/
PGP/GPG public key available on request

More information about the ffmpeg-devel mailing list