Bug 8218 - Excessively large amount of memory used with classes with large array members
Summary: Excessively large amount of memory used with classes with large array members
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Mark Mitchell
URL:
Keywords:
: 6804 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-13 18:56 UTC by brd
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brd 2002-10-13 18:56:06 UTC
//--------------------
class x
{
public:
    unsigned long mem[1024*1024*10];
    x();
};

class y : public x
{
public:
     y();
};
//--------------------

The preceeding piece of code consumes a VERY large amount of memory to
compile.

"record_subobject_offset" in class.c is being
called for EVERY item in x::mem

Release:
3.1

Environment:
RH 7.3

How-To-Repeat:
compile the code fragment in the description
Comment 2 Joe Buck 2002-10-14 18:15:34 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: See http://gcc.gnu.org/ml/gcc/2002-10/msg00675.html
Comment 3 Mark Mitchell 2002-10-16 12:13:56 UTC
Responsible-Changed-From-To: unassigned->mmitchel
Responsible-Changed-Why: I will be fixing this once the nice new book on computational
    geometry that I need shows up.
Comment 4 Mark Mitchell 2002-10-21 01:41:32 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.2.
Comment 5 Mark Mitchell 2002-10-21 08:40:25 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8218
Date: 21 Oct 2002 08:40:25 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2002-10-21 01:40:25
 
 Modified files:
 	gcc/cp         : ChangeLog class.c cp-tree.h 
 
 Log message:
 	PR c++/8218
 	* cp-tree.h (lang_type_class): Add contains_empty_class_p.
 	(CLASSTYPE_CONTAINS_EMPTY_CLASS_P): New macro.
 	* class.c (check_bases): Update CLASSTYPE_CONTAINS_EMPTY_CLASS_P.
 	(check_field_decls): Likewise.
 	(layout_class_type): Likewise.
 	(finish_struct_1): Initialize it.
 	(walk_subobject_offsets): Use it to prune searches.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3015&r2=1.3016
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.480&r2=1.481
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.760&r2=1.761
 

Comment 6 Mark Mitchell 2002-10-21 09:29:14 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8218
Date: 21 Oct 2002 09:29:14 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	mmitchel@gcc.gnu.org	2002-10-21 02:29:13
 
 Modified files:
 	gcc/cp         : ChangeLog class.c cp-tree.h 
 
 Log message:
 	PR c++/8218
 	* cp-tree.h (lang_type_class): Add contains_empty_class_p.
 	(CLASSTYPE_CONTAINS_EMPTY_CLASS_P): New macro.
 	* class.c (check_bases): Update CLASSTYPE_CONTAINS_EMPTY_CLASS_P.
 	(check_field_decls): Likewise.
 	(layout_class_type): Likewise.
 	(finish_struct_1): Initialize it.
 	(walk_subobject_offsets): Use it to prune searches.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.27&r2=1.2685.2.114.2.28
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.436.2.10.2.6&r2=1.436.2.10.2.7
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.681.2.12.2.5&r2=1.681.2.12.2.6