On Tue, Jul 03, 2012 at 12:37:44PM -0700, Richard Smith wrote:
> On Tue, Jul 3, 2012 at 1:14 AM, Joerg Sonnenberger
> <[email protected]>wrote:
> 
> > On Mon, Jul 02, 2012 at 11:23:05PM -0000, Richard Smith wrote:
> > > Log:
> > > -Wuninitialized: assume that an __attribute__((returns_twice)) function
> > might
> > > initialize any variable. This is extremely conservative, but is
> > sufficient for
> > > now.
> >
> > Can this be reduced to following both code paths if the function call is
> > part of a conditional?
> 
> 
> I'm not sure what you're suggesting; we do follow both code paths after a
> conditional. If you mean that we should track whether the function returned
> a nonzero value, and not apply this logic in that case, then I think that's
> out of scope for this check, and belongs in the static analyzer (if
> anywhere).

Consider the attached test case. I think we definitely want to warn
here.

Joerg
#include <stdio.h>
#include <setjmp.h>

jmp_buf e;

void g(void);

void f(void)
{
	int x;

	if (setjmp(e)) {
		x++;
		g();
	} else {
		x++;
		g();
	}
	g();
	printf("%d\n", x);
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to