This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18873] New: Segfault in layout_class_type -> splay_tree_delete
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Dec 2004 15:41:32 -0000
- Subject: [Bug c++/18873] New: Segfault in layout_class_type -> splay_tree_delete
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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