Bug 46565 - [4.5/4.6 Regression] ICE: SIGSEGV in pop_tinst_level (pt.c:7513) with -gstabs -g on invalid code
Summary: [4.5/4.6 Regression] ICE: SIGSEGV in pop_tinst_level (pt.c:7513) with -gstabs...
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P4 minor
Target Milestone: 4.5.3
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2010-11-19 16:18 UTC by Zdenek Sojka
Modified: 2011-03-11 21:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.6
Known to fail: 4.5.2, 4.6.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-11-19 16:18:01 UTC
------- testcase.C --------
template < int N > struct X {
  static const int value = X < N - 1 >::value;
};
template struct X <1000>;
---------------------------
(g++.dg/template/recurse2.C)

Compiler output:
$ gcc -gstabs -g testcase.C
testcase.C:1:27: error: template instantiation depth exceeds maximum of 1024 (use -ftemplate-depth= to increase the maximum) instantiating 'X<-0x00000000000000017>::value'
testcase.C:2:41:   recursively instantiated from 'const int X<999>::value'
testcase.C:2:41:   instantiated from 'const int X<1000>::value'
testcase.C:4:17:   instantiated from here

testcase.C:2:41: error: template instantiation depth exceeds maximum of 1024 (use -ftemplate-depth= to increase the maximum) instantiating 'struct X<-0x00000000000000019>'
testcase.C:2:41:   recursively instantiated from 'const int X<999>::value'
testcase.C:2:41:   instantiated from 'const int X<1000>::value'
testcase.C:4:17:   instantiated from here

testcase.C:2:41: error: incomplete type 'X<-0x00000000000000019>' used in nested name specifier
==3448== Invalid read of size 4
==3448==    at 0x518875: pop_tinst_level (pt.c:7513)
==3448==    by 0x54EAF2: instantiate_decl (pt.c:17402)
==3448==    by 0x550681: do_type_instantiation (pt.c:16682)
==3448==    by 0x5BAB68: cp_parser_explicit_instantiation (parser.c:12269)
==3448==    by 0x5BDD89: cp_parser_declaration (parser.c:9415)
==3448==    by 0x5BC569: cp_parser_declaration_seq_opt (parser.c:9328)
==3448==    by 0x5BE234: c_parse_file (parser.c:3445)
==3448==    by 0x6922F4: c_common_parse_file (c-opts.c:1070)
==3448==    by 0x9F7423: toplev_main (toplev.c:870)
==3448==    by 0x6376BBC: (below main) (in /lib64/libc-2.11.2.so)
==3448==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==3448== 
testcase.C:4:17: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Tested revisions:
r166936 - crash
4.5 r166509 - crash
4.4 r166509 - OK
Comment 1 Richard Biener 2010-12-16 13:03:03 UTC
GCC 4.5.2 is being released, adjusting target milestone.
Comment 2 Jason Merrill 2011-03-11 21:46:03 UTC
I can't reproduce this on head of 4.5 or 4.6.