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: Warning: `z' is used uninitialized in this function


On 11/10/2007, Roberto Bagnara <bagnara@cs.unipr.it> 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
list.

> 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.

Thanks,

Manuel.


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