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: 'SR.1419' is used uninitialized in this function...


Gabriel Dos Reis wrote:

Andrew Pinski <pinskia@physics.uc.edu> writes:

| On Jan 25, 2005, at 12:58 PM, Benjamin Redelings wrote:
| | > Hello,
| >
| > I'm testing 4.0 snapshot 2005-01-15 by trying to compile my
| > program. I get error messages like the following a few times:
| >
| > 'SR.1419' is used uninitialized in this function...
| >
| > I'm guessing that this is an SSA name and should not be reported to
| > the user. Is this a known bug? Should I file a PR?
| | Yes it is known but it is most likely a bug in your code.
| The problem is that SR.1419 should really be named
| "<<unnamed>>.structmember".


Not really.  I've already filled a PR (which I think  you quickly
closed) where SR.xxxx should have been A::i (where A is a base
class).  I wanted to fix this by using DECL_ABSTRACT_ORIGIN but RTH
thinks that is not appropriate.  Anyhow, we need to put a back
reference to the original tree that was SRAed.

-- Gaby



I now have a 30-line test-case (attatched) which triggers two bugs: a) the structure member has a name, but is not named. b) the structure member is not actually used, despite the warning.

Ways to make the problem go away include:
a) make a function non-virtual
b) make a function not a template
c) remove the undefined, and supposedly unused variable.
d) turn off all optimization.

-BenRI
struct branchview;

struct iterator 
{
  unsigned circuits;  // Warning goes away if you remove this line

  virtual branchview operator*() const;  // Warning goes away if you remove 'virtual'

  iterator() {}
};

struct branchview 
{
  iterator my_iterator() const {return iterator();}

  branchview(){}
};

inline branchview iterator::operator*() const {
  return branchview();
}

// You have to do this inside a template to get the bug, I think.
template<class iterator_t>
inline void append(const iterator_t& start, branchview& t) {
  iterator_t i = start;
  t = *i;
}

void iterator_set(const branchview& bv1,branchview& bv2) {
  append(bv1.my_iterator(),bv2);
}

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