This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Warning: `z' is used uninitialized in this function
- From: Roberto Bagnara <bagnara at cs dot unipr dot it>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 11 Oct 2007 18:02:30 +0200
- Subject: Warning: `z' is used uninitialized in this function
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?
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:
template <typename To_Policy, typename From1_Policy, typename From2_Policy, typename Type>
inline Result
add_mul_int(Type& to, const Type x, const Type y, Rounding_Dir dir) {
Type z;
Result r = mul<To_Policy, From1_Policy, From2_Policy>(z, x, y, dir);
switch (r) {
case V_NEG_OVERFLOW:
case V_LT:
if (to <= 0) {
to = z; (***)
return r;
}
All the best,
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it