------- 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