This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17347] New: C++ FE produces invalid CONSTRUCTOR trees for vtables


According to the docs, and what every other frontend does, CONSTRUCTOR_ELTS for 
an array type contains a tree_list where: 
 
   For ARRAY_TYPE: 
   The TREE_PURPOSE of each node is the corresponding index. 
   If the TREE_PURPOSE is a RANGE_EXPR, it is a short-hand for many nodes, 
   one for each index in the range.  (If the corresponding TREE_VALUE 
   has side-effects, they are evaluated once for each element.  Wrap the 
   value in a SAVE_EXPR if you want to evaluate side effects only once.) 
 
 
vtables produce an array_type whose constructor list has no TREE_PURPOSE on 
each node (it's NULL). 
 
 
(gdb) p debug_tree (decl) 
 <var_decl 0x40139414 _ZTVSt9exception 
    type <array_type 0x401396cc 
.... 
 
(gdb) p debug_tree (decl.decl.initial) 
 <constructor 0x4005bb80 
    arg 0 <tree_list 0x401383c0 
        value <nop_expr 0x4005bac0 type <pointer_type 0x400cec3c 
__vtbl_ptr_type> 
            constant invariant 
            arg 0 <integer_cst 0x40138348 constant invariant 0>> 
        chain <tree_list 0x401383a8 
            value <nop_expr 0x4005baa0 type <pointer_type 0x400cec3c 
__vtbl_ptr_type> 
                readonly constant invariant 
.... 
(note the lack of purpose trees) 
 
simple testcase: 
 
extern "C++" 
{ 
  namespace std 
  { 
    class exception 
    { 
    public:exception () throw () 
      { 
      } virtual ~ exception () throw (); 
      virtual const char *what () const throw (); 
    }; 
  } 
  namespace __cxxabiv1 
  { 
  } 
  namespace std 
  { 
    class bad_cast:public exception 
    { 
    public:bad_cast () throw () 
      { 
      } virtual ~ bad_cast () throw (); 
    }; 
  } 
} 
namespace __cxxabiv1 
{ 
  extern "C" void __cxa_bad_cast (); 
} 
extern "C" void 
__cxxabiv1::__cxa_bad_cast () 
{ 
  throw std::bad_cast (); 
}

-- 
           Summary: C++ FE produces invalid CONSTRUCTOR trees for vtables
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dberlin at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17347


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]