This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.

Hi Daniel,


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:

  int x;
  if (do_init) init_x(&x); else set_x(&x);
  use_x(x);

Thank you again. Regards, Bruce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]