[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug middle-end/19430] taking address of a var causes missing uninitialized warning



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

--- Comment #30 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #29)
> What remains seems to be complaining that
> 
>   int i;
>   foo (&i);
> 
> doesn't warn.  And we have another bug that
> 
>   int i;
>   foo (&i);
>   ... = i;
> 
> doesn't warn for the read from i.
> 
> I think both of these need a different warning level as foo may not read
> from i and foo may initialize i.

This is not what this bug is about. Please read the discussions. It seems a
waste of people's goodwill and effort over the years to close bugs as
invalid/duplicates without understanding why they were open in the first place.

This bug is about (comment #0)

extern int bar (int);
extern void baz (int *);

int
foo (int i)
{
  int j;

  if (bar (i)) {
    // These should do the same with respect to `j':
    baz (&j);
    // j = 1;
  }
  return j;
}


If bar(i) returns false, j is never initialized. The bug implicitly assumes
that baz(&j) does initialize j, thus it satisfies the heuristic used in GCC and
still there should be a "may be" warning.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply to: