This is the mail archive of the
mailing list for the GCC project.
Re: Warning: `z' is used uninitialized in this function
- From: "Manuel López-Ibáñez" <lopezibanez at gmail dot com>
- To: "Roberto Bagnara" <bagnara at cs dot unipr dot it>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 11 Oct 2007 17:30:34 +0100
- Subject: Re: Warning: `z' is used uninitialized in this function
- References: <470E4916.email@example.com>
On 11/10/2007, Roberto Bagnara <firstname.lastname@example.org> wrote:
> Just to make sure before I submit a bug report: when GCC says that
> a certain variable _is_ (as opposed to _may be_) used uninitialized
> in this function, it means that it has proved that the variable
> is indeed used uninitialized, right?
When GCC says that a certain variable "is used" uninitialized, it just
means that it has found a SSA name with an empty definition in a
particular BB. That proves nothing about a variable being used
uninitialized, since, that BB may be conditional or it may not even be
executed at all.
Nonetheless, this is not the desirable behaviour so, please submit a
bug report and if possible, attach the smallest self-contained
testcase and the *.ssa file obtained by adding the option
-fdump-tree-all-all. Please add manu at gcc dot gnu dot org to the CC
> I am asking because I have a testcase where g++ gives this warning for
> `z' in the statement marked with (***) below. However, `z' is indeed
> initialized by the mul() function template, which takes the first
> argument by (non-const) reference:
The current Wuninitialized mechanism does not handle memory references
well (it does not handle virtual operands at all), so it gets easily
confused by pointers, references, arrays, etc. I am almost sure that
the wrong warning is a consequence of the combination of this and the
previously mentioned issues.