This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/39358] [4.4 regression] Wrong aliasing warning with lists



------- Comment #1 from reichelt at gcc dot gnu dot org  2009-03-03 22:49 -------
Reduced testcase:

========================================================
struct Node_base {};

struct Node : Node_base
{
  int data;
};


struct List
{
  Node_base node, *prev;

  List() : prev(&node) { xyz(); }

  void xyz();

  int back() { return static_cast<Node*>(prev)->data; }
};


struct A
{
  virtual ~A();
};

A* foo();

void bar()
{
  List y;
  if (y.back())
    delete foo();
}
========================================================

To me it looks as if "prev(&node)" in List's ctor makes the middle-end
believe that prev points to a Node_base that is not a Node. However,
the function xyz might change "prev" to point to a real Node, so this
is not a valid assumption.

At least it's not list's fault, but really a problem in the middle-end.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39358


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