struct D { D(); };
struct E : D { E(); };
struct C { E e[4000]; };

struct A
{
  A () {}
  struct C m[128];
};

struct B : public A
{
  B () {}
};

with any -Ox and with any of -m{32,64} segfaults with the default stack rlimit
(10MB) in GCC 3.4.3, HEAD and 3.2.3 as well.
empty_base_offsets has hundreds thousands of nodes in layout_class_type
and splay_tree_delete_helper uses recursion, so in this particular case the
recursion is > hundred thousands frames deep.  Each recursive call occupies
32 bytes on the stack (and x86_64 in this regard is certainly not host with
biggest frame size), so already 300000 recursive calls almost reach the 10MB
limit.

Now, I don't know if it is a bug that for this simple struct it needs > 500000
splay tree nodes and whether splay tree is the best data structure for this 
usage
(haven't looked much what exactly it is using it for) but if that is ok, then
splay-tree.c should be optimized.
Certainly splay_tree_delete can be done without any recursion.

-- 
           Summary: Segfault in layout_class_type -> splay_tree_delete
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: x86_64-redhat-linux


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

Reply via email to