On 08/09/2020 15:48, Mark Johnston wrote:
> I observed the same thing recently as well: the compiler catches
> uninitialized variables only in simple cases.  In my case, any uses of
> goto within the function seemed to silence the warning, even if they
> appeared after the uninitialized reference.

I am running a kernel build now with this addition (for clang):
CWARNEXTRA+=   -Wconditional-uninitialized -Wno-error-conditional-uninitialized

It produces a ton of warnings.
Some of them are probably false positives, but some look quite reasonable.

E.g.:
sys/cam/cam_periph.c:314:19: warning: variable 'p_drv' may be uninitialized when
used here [-Wconditional-uninitialized]
                TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);

Indeed, there is a conditional 'goto failure' before a first assignment to p_drv
and the line is after the label.  So, maybe the situation is impossible, but it
is reasonable to warn about it.

But the number of false positives (and "possible but impossible" situations) is
too overwhelming.

-- 
Andriy Gapon
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to