This is the mail archive of the
mailing list for the GCC project.
Re: 'xxx' may be used uninitialized in this function
As you probably know by now, one can't look at a bug of this sort
without a compilable test case. Andrew correctly pointed out that this
optimization is affected by (for instance) inlining.
The function referenced is in a separate compilation unit and
even if it were in the same unit, it is referenced multiple times
and is sufficiently complex that inlining is highly improbable.
Anyway, there is no code path that does not set the value and
there is no code path that references the initial value, even if
it were inlined. The warning was issued because "xxx" was
used after (one of) the calls to the setting functions. If that is
a bug with the flow analysis and warning generation, then I will
construct a simple example that shows it and provide detailed
compiler information. I confess to assuming that the analysis
was expected to be beyond GCC's abilities. The examples
regarding flow analysis abilities do not cover this scenario:
if (do_init) init_x(&x); else set_x(&x);
Thank you again. Regards, Bruce