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

           Summary: [4.6 Regression] ICE: SIGSEGV in grokbitfield
                    (decl2.c:1054) in C++0x mode on invalid code
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: zso...@seznam.cz


---- testcase.C ----
template<int>
class A
{
  A : i() {}
  int i;
};
--------------------

Related valgrind output:
$ gcc testcase.C -std=c++0x
testcase.C:4:9: error: there are no arguments to 'i' that depend on a template
parameter, so a declaration of 'i' must be available [-fpermissive]
testcase.C:4:9: note: (if you use '-fpermissive', G++ will accept your code,
but allowing the use of an undeclared name is deprecated)
==10499== Invalid read of size 2
==10499==    at 0x55336E: grokbitfield (decl2.c:1054)
==10499==    by 0x59013B: cp_parser_member_declaration (parser.c:17645)
==10499==    by 0x572F13: cp_parser_type_specifier (parser.c:17392)
==10499==    by 0x574787: cp_parser_decl_specifier_seq (parser.c:9890)
==10499==    by 0x58CACA: cp_parser_single_declaration (parser.c:19787)
==10499==    by 0x58D04D: cp_parser_template_declaration_after_export
(parser.c:19700)
==10499==    by 0x591DA9: cp_parser_declaration (parser.c:9369)
==10499==    by 0x5904B9: cp_parser_declaration_seq_opt (parser.c:9299)
==10499==    by 0x592144: c_parse_file (parser.c:3432)
==10499==    by 0x667B69: c_common_parse_file (c-opts.c:1162)
==10499==    by 0x9D42FF: toplev_main (toplev.c:919)
==10499==    by 0x6376BBC: (below main) (in /lib64/libc-2.11.2.so)
==10499==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==10499== 
testcase.C:4:9: 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:
r166210 - crash
r166153 - OK

Reply via email to