https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109550

--- Comment #2 from Frank Heckenbach <f.heckenb...@fh-soft.de> ---
It might be useful then to actually say to in the warning, e.g. "p[...] may be
used uninitialized". This might have saved me some debugging effort.

But actually, that's not all. This code still gives the warning, although the
memory pointed to is now initialized:

#include <stdlib.h>

void f (int, char const *);
void g (int);

void a (int n, char const *s)
{
  char *p = alloca (n);
  for (int i = 0; i < n; i++)
    p[i] = s[i];
  f (n, p);
  for (int i = 0; i < n; i++)
    g (i);
}

Though this time, the warning disappears when I remove the unrelated code below
(with the call to g). Why is that?

Reply via email to