This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/39358] [4.4 regression] Wrong aliasing warning with lists
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Mar 2009 22:49:43 -0000
- Subject: [Bug tree-optimization/39358] [4.4 regression] Wrong aliasing warning with lists
- References: <bug-39358-1771@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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