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]

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


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