public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die
@ 2004-01-05 23:09 pabel at iam dot uni-bonn dot de
2004-01-05 23:45 ` [Bug c++/13574] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: pabel at iam dot uni-bonn dot de @ 2004-01-05 23:09 UTC (permalink / raw)
To: gcc-bugs
When trying to compile this program
---
class A {
public:
#ifdef SAFE
A() : argc(0) { };
#else
A() : argc(0), argv() { };
#endif
private:
int argc;
char* argv[];
};
int main() {
A y;
}
---
with g++ without -DSAFE, the compiler consumes all memory until it chokes:
g++ argv.cpp -o argv -Wall
virtual memory exhausted: Cannot allocate memory
It does not happen when using "char**" as type.
some info:
uname -a
Linux operator 2.4.20-4GB #1 Wed Oct 29 22:20:11 CET 2003 i686 i686 i386
GNU/Linux
g++ -v
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
--enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.1 (SuSE Linux)
--
Summary: array default initializer in class lets gcc consume all
memory and die
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pabel at iam dot uni-bonn dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: Linux 2.4.20-4GB i686
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3/3.4 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
@ 2004-01-05 23:45 ` pinskia at gcc dot gnu dot org
2004-01-10 22:11 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-05 23:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-05 23:45 -------
Confirmed a regression from 3.2.3, I am not going to run Phil's regression hunter on this
because it would cause problems for Phil's machine.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code
Last reconfirmed|0000-00-00 00:00:00 |2004-01-05 23:45:36
date| |
Summary|array default initializer in|[3.3/3.4 Regression] array
|class lets gcc consume all |default initializer in class
|memory and die |lets gcc consume all memory
| |and die
Target Milestone|--- |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3/3.4 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
2004-01-05 23:45 ` [Bug c++/13574] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-01-10 22:11 ` pinskia at gcc dot gnu dot org
2004-01-10 22:18 ` hubicka at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-10 22:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-10 22:11 -------
This should have been rejected just as ICC 6.0 (in strict ANSI mode only).
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords|ice-on-valid-code |ice-on-invalid-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3/3.4 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
2004-01-05 23:45 ` [Bug c++/13574] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-01-10 22:11 ` pinskia at gcc dot gnu dot org
@ 2004-01-10 22:18 ` hubicka at gcc dot gnu dot org
2004-01-16 17:50 ` mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2004-01-10 22:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From hubicka at gcc dot gnu dot org 2004-01-10 22:18 -------
Note that the memory consumption happens while trying to intialize the array and
taking (unsigned int)-1 as upper bound.#0 0x40093d45 in memset () from
/lib/libc.so.6
#1 0x084f61a7 in ggc_alloc (size=67108852) at ../../gcc/ggc-page.c:1156
#2 0x0832ab45 in ggc_alloc_cleared (size=67108852) at ../../gcc/ggc-common.c:134
#3 0x0832abe2 in ggc_calloc (s1=16777213, s2=4) at ../../gcc/ggc-common.c:188
#4 0x085a12b9 in htab_expand (htab=0x40177780) at ../../libiberty/hashtab.c:393
#5 0x085a149d in htab_find_slot_with_hash (htab=0x40177780, element=0x5acac8fc,
hash=140315878, insert=INSERT)
at ../../libiberty/hashtab.c:510
#6 0x085a14cf in htab_find_slot (htab=0x40177780, element=0x5acac8fc,
insert=INSERT) at ../../libiberty/hashtab.c:558
#7 0x082d294b in size_int_type_wide (number=6291408, type=0x401799b4) at
../../gcc/fold-const.c:1569
#8 0x082d1662 in int_const_binop (code=PLUS_EXPR, arg1=0x5acac8c0,
arg2=0x4016d94c, notrunc=0) at ../../gcc/fold-const.c:1334
#9 0x082d2aa0 in size_binop (code=PLUS_EXPR, arg0=0x5acac8c0, arg1=0x4016d94c)
at ../../gcc/fold-const.c:1609
#10 0x0815d7a0 in build_zero_init (type=0x4024372c, nelts=0x0,
static_storage_p=false) at ../../gcc/cp/init.c:231
#11 0x0815d8dc in build_default_init (type=0x4024372c, nelts=0x0) at
../../gcc/cp/init.c:296
#12 0x0815dc81 in perform_member_init (member=0x40243798, init=0x0) at
../../gcc/cp/init.c:362
#13 0x0815ee30 in emit_mem_initializers (mem_inits=0x40238ed8) at
../../gcc/cp/init.c:694
#14 0x0817abe3 in finish_mem_initializers (mem_inits=0x40238e88) at
../../gcc/cp/semantics.c:1187
#15 0x08127ed8 in cp_parser_mem_initializer_list (parser=0x40242800) at
../../gcc/cp/parser.c:7063
#16 0x08127db7 in cp_parser_ctor_initializer_opt (parser=0x40242800) at
../../gcc/cp/parser.c:7020
#17 0x0812cdb5 in cp_parser_ctor_initializer_opt_and_function_body
(parser=0x40242800) at ../../gcc/cp/parser.c:11183
#18 0x08131453 in cp_parser_function_definition_after_declarator
(parser=0x40242800, inline_p=true)
at ../../gcc/cp/parser.c:13989
#19 0x08132047 in cp_parser_late_parsing_for_member (parser=0x40242800,
member_function=0x402433cc)
at ../../gcc/cp/parser.c:14380
#20 0x0812db6b in cp_parser_class_specifier (parser=0x40242800) at
../../gcc/cp/parser.c:11650
#21 0x08129c5f in cp_parser_type_specifier (parser=0x40242800,
flags=CP_PARSER_FLAGS_OPTIONAL, is_friend=false,
is_declaration=true, declares_class_or_enum=0xbffff620,
is_cv_qualifier=0xbffff61f) at ../../gcc/cp/parser.c:8541
#22 0x08127813 in cp_parser_decl_specifier_seq (parser=0x40242800,
flags=CP_PARSER_FLAGS_OPTIONAL, attributes=0xbffff66c,
declares_class_or_enum=0xbffff668) at ../../gcc/cp/parser.c:6652
#23 0x081274df in cp_parser_simple_declaration (parser=0x40242800,
function_definition_allowed_p=true)
at ../../gcc/cp/parser.c:6382
#24 0x081274ac in cp_parser_block_declaration (parser=0x40242800,
statement_p=false) at ../../gcc/cp/parser.c:6342
#25 0x08127359 in cp_parser_declaration (parser=0x40242800) at
../../gcc/cp/parser.c:6262
#26 0x08127184 in cp_parser_declaration_seq_opt (parser=0x40242800) at
../../gcc/cp/parser.c:6171
#27 0x08122d82 in cp_parser_translation_unit (parser=0x40242800) at
../../gcc/cp/parser.c:2307
#28 0x0813315c in c_parse_file () at ../../gcc/cp/parser.c:15044
#29 0x081f4be8 in c_common_parse_file (set_yydebug=0) at ../../gcc/c-opts.c:1216
#30 0x084b9390 in compile_file () at ../../gcc/toplev.c:1804
#31 0x084be34e in do_compile () at ../../gcc/toplev.c:4611
#32 0x084be3e6 in toplev_main (argc=3, argv=0xbffff834) at ../../gcc/toplev.c:4651
#33 0x081f8fcf in main (argc=3, argv=0xbffff834) at ../../gcc/main.c:35
ibm:~ #
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3/3.4 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (2 preceding siblings ...)
2004-01-10 22:18 ` hubicka at gcc dot gnu dot org
@ 2004-01-16 17:50 ` mmitchel at gcc dot gnu dot org
2004-01-16 19:28 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-16 17:50 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (4 preceding siblings ...)
2004-01-16 19:28 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-16 19:28 ` mmitchel at gcc dot gnu dot org
2004-01-16 19:33 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-01-16 19:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-01-16 19:28 -------
Fixed in GCC 3.4.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
Summary|[3.3/3.4 Regression] array |[3.3 Regression] array
|default initializer in class|default initializer in class
|lets gcc consume all memory |lets gcc consume all memory
|and die |and die
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3/3.4 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (3 preceding siblings ...)
2004-01-16 17:50 ` mmitchel at gcc dot gnu dot org
@ 2004-01-16 19:28 ` cvs-commit at gcc dot gnu dot org
2004-01-16 19:28 ` [Bug c++/13574] [3.3 " mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-16 19:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-01-16 19:28 -------
Subject: Bug 13574
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2004-01-16 19:28:11
Modified files:
gcc/cp : ChangeLog decl.c init.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/ext: array1.C
Log message:
PR c++/13574
* decl.c (compute_array_index_type): Fix grammar in comment.
* init.c (build_zero_init): Handle zero-sized arrays correctly.
PR c++/13574
* g++.dg/ext/array1.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3891&r2=1.3892
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1173&r2=1.1174
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.355&r2=1.356
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3388&r2=1.3389
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/array1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (5 preceding siblings ...)
2004-01-16 19:28 ` [Bug c++/13574] [3.3 " mmitchel at gcc dot gnu dot org
@ 2004-01-16 19:33 ` pinskia at gcc dot gnu dot org
2004-01-21 8:06 ` cvs-commit at gcc dot gnu dot org
2004-01-21 8:07 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-16 19:33 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.0 |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (6 preceding siblings ...)
2004-01-16 19:33 ` pinskia at gcc dot gnu dot org
@ 2004-01-21 8:06 ` cvs-commit at gcc dot gnu dot org
2004-01-21 8:07 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-21 8:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-01-21 08:06 -------
Subject: Bug 13574
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: gdr@gcc.gnu.org 2004-01-21 08:06:38
Modified files:
gcc/cp : ChangeLog decl.c init.c
Added files:
gcc/testsuite/g++.dg/ext: array1.C
Log message:
Backport from mainline
2004-01-16 Mark Mitchell <mark@codesourcery.com>
PR c++/13574
* decl.c (compute_array_index_type): Fix grammar in comment.
* init.c (build_zero_init): Handle zero-sized arrays correctly.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.241&r2=1.3076.2.242
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.71&r2=1.965.2.72
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.299.2.12&r2=1.299.2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/array1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.6.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/13574] [3.3 Regression] array default initializer in class lets gcc consume all memory and die
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
` (7 preceding siblings ...)
2004-01-21 8:06 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-21 8:07 ` gdr at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-01-21 8:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-01-21 08:07 -------
Fixed with backport from 3.4.0
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-01-21 8:07 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-05 23:09 [Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die pabel at iam dot uni-bonn dot de
2004-01-05 23:45 ` [Bug c++/13574] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-01-10 22:11 ` pinskia at gcc dot gnu dot org
2004-01-10 22:18 ` hubicka at gcc dot gnu dot org
2004-01-16 17:50 ` mmitchel at gcc dot gnu dot org
2004-01-16 19:28 ` cvs-commit at gcc dot gnu dot org
2004-01-16 19:28 ` [Bug c++/13574] [3.3 " mmitchel at gcc dot gnu dot org
2004-01-16 19:33 ` pinskia at gcc dot gnu dot org
2004-01-21 8:06 ` cvs-commit at gcc dot gnu dot org
2004-01-21 8:07 ` gdr at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).