[Bug tree-optimization/39358] [4.4 regression] Wrong aliasing warning with lists
reichelt at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 3 22:49:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list