c++/10033: [3.2 regression] optimization breaks polymorphic references w/ 'typeid' operator

bangerth@dealii.org bangerth@dealii.org
Wed Mar 12 14:56:00 GMT 2003


Old Synopsis: optimization breaks polymorphic references w/ 'typeid' operator
New Synopsis: [3.2 regression] optimization breaks polymorphic references w/ 'typeid' operator

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Mar 12 14:24:17 2003
State-Changed-Why:
    Confirmed. Here's a smaller testcase:
    ---------------------
    #include <cstdlib>
    #include <typeinfo>
    
    struct A {
        virtual ~A() { }
    };
    
    struct B : public A { };
    
    int main()
    {
        B bobj;
        A& aref = bobj;
    
        if (typeid(aref) != typeid(B))
          abort();
    
        return 0;
    }
    --------------------------------
    It executes just fine with 3.0, 3.3 and 3.4, but
    aborts with 3.2 when given -O2. So it's a regression
    of 3.2 only.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10033



More information about the Gcc-bugs mailing list