http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47389
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-21 00:59:37 UTC --- Created attachment 23056 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23056 range-for testcase Probably the same problem. $ gcc -fno-for-scope -std=c++0x testcase.C testcase.C: In function 'void foo(const T&)': testcase.C:3:16: internal compiler error: in begin_range_for_stmt, at cp/semantics.c:965 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. (gdb) bt #0 fancy_abort (file=0x11f4eb0 "/mnt/svn/gcc-trunk/gcc/cp/semantics.c", line=965, function=0x11f7910 "begin_range_for_stmt") at /mnt/svn/gcc-trunk/gcc/diagnostic.c:892 #1 0x000000000062b14b in begin_range_for_stmt (scope=0x0, init=0x7ffff5d2caa0) at /mnt/svn/gcc-trunk/gcc/cp/semantics.c:965 #2 0x00000000005ca742 in cp_parser_range_for (parser=0x7ffff5d47108, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8775 #3 cp_parser_for (parser=0x7ffff5d47108, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8715 #4 cp_parser_iteration_statement (parser=0x7ffff5d47108, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9016 #5 cp_parser_statement (parser=0x7ffff5d47108, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8075 #6 0x00000000005cab66 in cp_parser_statement_seq_opt (parser=0x7ffff5d47108, in_statement_expr=0x0) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8416 #7 0x00000000005cac9c in cp_parser_compound_statement (parser=0x7ffff5d47108, in_statement_expr=0x0, in_try=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8370 #8 0x00000000005de70c in cp_parser_function_body (parser=0x7ffff5d47108) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:16399 #9 cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff5d47108) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:16436 #10 0x00000000005dee82 in cp_parser_function_definition_after_declarator (parser=0x7ffff5d47108, inline_p=0 '\000') at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19842 #11 0x00000000005e04ce in cp_parser_function_definition_from_specifiers_and_declarator (parser=0x7ffff5d47108, decl_specifiers=0x7fffffffd790, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd7ff "\001\bq\324\365\377\177", maybe_range_for_decl=0x0) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19771 #12 cp_parser_init_declarator (parser=0x7ffff5d47108, decl_specifiers=0x7fffffffd790, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd7ff "\001\bq\324\365\377\177", maybe_range_for_decl=0x0) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:14538 #13 0x00000000005e4c75 in cp_parser_single_declaration (parser=0x7ffff5d47108, checks=0x0, member_p=0 '\000', explicit_specialization_p=0 '\000', friend_p=0x7fffffffd85f "") at /mnt/svn/gcc-trunk/gcc/cp/parser.c:20096 #14 0x00000000005e4fd6 in cp_parser_template_declaration_after_export (parser=0x7ffff5d47108, member_p=0 '\000') at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19946 #15 0x00000000005e9a3a in cp_parser_declaration (parser=0x7ffff5d47108) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9444 #16 cp_parser_declaration (parser=0x7ffff5d47108) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9395 #17 0x00000000005e833a in cp_parser_declaration_seq_opt (parser=0x7ffff5d47108) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9374 #18 0x00000000005e9e89 in cp_parser_translation_unit () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:3463 #19 c_parse_file () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:25269 #20 0x00000000006be125 in c_common_parse_file () at /mnt/svn/gcc-trunk/gcc/c-family/c-opts.c:1071 #21 0x0000000000a213e6 in compile_file (argc=15, argv=0x7fffffffdab8) at /mnt/svn/gcc-trunk/gcc/toplev.c:579 #22 do_compile (argc=15, argv=0x7fffffffdab8) at /mnt/svn/gcc-trunk/gcc/toplev.c:1874 #23 toplev_main (argc=15, argv=0x7fffffffdab8) at /mnt/svn/gcc-trunk/gcc/toplev.c:1937 #24 0x00007ffff65f1bbd in __libc_start_main () from /lib/libc.so.6 #25 0x00000000004fa9d1 in _start ()