The is huge bug which effects a large amount of C++, we should not abort. extern "C" void abort(void); struct T1 {int a, b; virtual void f(){}}; struct T : T1 { struct T1 w; int b; }; void foo (struct T1 *p) { struct T *q = dynamic_cast<T*>(p); if (q->b != 2) abort (); } int main () { struct T c; c.b = 2; foo (&c); return 0; }
-- Summary: [4.1 Regression] wrong code with upcast in C++ Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: wrong-code Severity: critical Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: dberlin at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21407