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]

Re: Ada files now checked in


On Sat, 06 Oct 2001, dewar@gnat.com wrote:

> <<$ gcc -Wuninitialized -ftree-ssa foo.c -O -c
> foo.c: In function `main':
> foo.c:3: warning: `b' is used uninitialized in this function
> >>
> 
> Right, I know about those messages, the trouble is that the message
> does not point to the problem point, it points instead to the declaration
> of b. What you need in more complex cases is a pointer to the exact
> occurrence that is detected as potentially troublesome
>
No, this is based on the new tree SSA infrastructure (BTW, I had
cut&pasted the wrong output in my inital message).

This will always point to the line with a use of an uninitialized
variable:

-----------------------------------------------------------------------------
$ cat rdefs.c
main()
{
  int a, b;

  a = b + 4;
  if (a > 0)
    b = b + 3;
}

$ gcc -Wuninitialized -ftree-ssa rdefs.c -O -c
rdefs.c: In function `main':
rdefs.c:5: warning: `b' is used uninitialized in this function
rdefs.c:7: warning: `b' is used uninitialized in this function
-----------------------------------------------------------------------------

As I said, I'm still debugging this work, but the basic
infrastructure is already in the AST branch.


Diego.


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