http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50791
--- Comment #2 from yar at sibnet dot ru 2011-10-19 12:54:59 UTC --- The code in first attachment make cc1plus stack overflow. The code in second attachment doesn't. Backtrace: #0 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17459 #1 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #2 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #3 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #4 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #5 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #6 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #7 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #8 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #9 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #10 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 <...> #261894 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #261895 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #261896 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #261897 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #261898 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #261899 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #261900 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #261901 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #261902 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #261903 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #261904 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #261905 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #261906 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #261907 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #261908 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #261909 0x080766ec in dependent_type_p_r (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17371 #261910 dependent_type_p (type=0xb7f22cc0) at ../../gcc/cp/pt.c:17484 #261911 0x08076772 in dependent_type_p_r (type=0xb7f22960) at ../../gcc/cp/pt.c:17448 #261912 dependent_type_p (type=0xb7f22960) at ../../gcc/cp/pt.c:17484 #261913 0x080769f8 in dependent_template_arg_p (arg=0xb7f22960) at ../../gcc/cp/pt.c:17903 #261914 0x08076a89 in any_dependent_template_arguments_p (args=0xb7f2b3d4) at ../../gcc/cp/pt.c:17979 #261915 0x080775e8 in uses_template_parms (t=0xb7f2b3d4) at ../../gcc/cp/pt.c:7045 #261916 0x08077931 in register_specialization (spec=0xb7f2c100, tmpl=0xb7ec6c98, args=0xb7f2b3d4, is_friend=0 '\000', hash=1919156452) at ../../gcc/cp/pt.c:1280 #261917 0x08079a68 in tsubst_decl (t=0xb7f1c200, args=0xb7f2b3b8, complain=0) at ../../gcc/cp/pt.c:9214 #261918 0x0808a9a6 in instantiate_template (tmpl=0xb7ec6c98, orig_args=0xb7f2b3b8, complain=0) at ../../gcc/cp/pt.c:13082 #261919 0x08053221 in add_template_candidate_real (candidates=0xbfffe5d8, tmpl=0xb7ec6c98, ctype=0x0, explicit_targs=0x0, first_arg=0x0, arglist=0xb7f24a78, return_type=0x0, access_path=0x0, conversion_path=0x0, flags=3, obj=0x0, strict=DEDUCE_CALL) at ../../gcc/cp/call.c:2536 #261920 0x08053487 in add_template_candidate (fns=0xb7f24a8c, args=0xb7f24a78, explicit_targs=0x0, template_only=0 '\000', conversion_path=0x0, access_path=0x0, flags=3, candidates=0xbfffe5d8) at ../../gcc/cp/call.c:2612 #261921 add_candidates (fns=0xb7f24a8c, args=0xb7f24a78, explicit_targs=0x0, template_only=0 '\000', conversion_path=0x0, access_path=0x0, flags=3, candidates=0xbfffe5d8) at ../../gcc/cp/call.c:4118 #261922 0x08059fa7 in build_new_op (code=BIT_IOR_EXPR, flags=3, arg1=0xb7ea4488, arg2=0xb7f271cc, arg3=0x0, overloaded_p=0xbfffe74f "", complain=3) at ../../gcc/cp/call.c:4248 #261923 0x080c3c7b in build_x_binary_op (code=BIT_IOR_EXPR, arg1=0xb7ea4488, arg1_code=ERROR_MARK, arg2=<value optimized out>, arg2_code=ERROR_MARK, overloaded_p=0xbfffe74f "", complain=3) at ../../gcc/cp/typeck.c:3490 #261924 0x080b2acb in cp_parser_binary_expression (parser=0xb7f25410, cast_p=<value optimized out>, no_toplevel_fold_p=0 '\000', prec=PREC_NOT_OPERATOR, pidk=0x0) at ../../gcc/cp/parser.c:6464 #261925 0x080b2c77 in cp_parser_assignment_expression (parser=<value optimized out>, cast_p=<value optimized out>, pidk=<value optimized out>) at ../../gcc/cp/parser.c:6561 #261926 0x080b31a1 in cp_parser_constant_expression (parser=0xb7f25410, allow_non_constant_p=1 '\001', non_constant_p=0xbfffe85e "") at ../../gcc/cp/parser.c:6786 #261927 0x080b34df in cp_parser_initializer_clause (parser=<value optimized out>, non_constant_p=0xbfffe85e "") at ../../gcc/cp/parser.c:15512 #261928 0x080afbca in cp_parser_init_declarator (parser=0xb7f25410, decl_specifiers=0xbfffe894, checks=0x0, function_definition_allowed_p=0 '\000', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0xbfffe8ef "") at ../../gcc/cp/parser.c:13708 #261929 0x080b84cd in cp_parser_simple_declaration (parser=0xb7f25410, function_definition_allowed_p=<value optimized out>) at ../../gcc/cp/parser.c:8947 #261930 0x080b894a in cp_parser_block_declaration (parser=0xb7f25410, statement_p=1 '\001') at ../../gcc/cp/parser.c:8845 #261931 0x080b90f1 in cp_parser_declaration_statement (parser=<value optimized out>) at ../../gcc/cp/parser.c:8502 #261932 0x080ae6e1 in cp_parser_statement (parser=0xb7f25410, in_statement_expr=0x0, in_compound=<value optimized out>, if_p=0x0) at ../../gcc/cp/parser.c:7676 #261933 0x080af164 in cp_parser_statement_seq_opt (parser=0xb7f25410, in_statement_expr=0x0) at ../../gcc/cp/parser.c:7928 #261934 0x080af1db in cp_parser_compound_statement (parser=0xb7f25410, in_statement_expr=0x0, in_try=<value optimized out>) at ../../gcc/cp/parser.c:7885 #261935 0x080b91ba in cp_parser_ctor_initializer_opt_and_function_body (parser=0xb7f25410) at ../../gcc/cp/parser.c:15413 #261936 0x080af3a2 in cp_parser_function_definition_after_declarator (parser=0xb7f25410, inline_p=0 '\000') at ../../gcc/cp/parser.c:18653 #261937 0x080afd67 in cp_parser_function_definition_from_specifiers_and_declarator (parser=0xb7f25410, decl_specifiers=<value optimized out>, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0xbfffebff "\001P\267\375\267\216ACN8\354\377\277\020T\362\267D\304", <incomplete sequence \345\267>) at ../../gcc/cp/parser.c:18582 #261938 cp_parser_init_declarator (parser=0xb7f25410, decl_specifiers=<value optimized out>, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0xbfffebff "\001P\267\375\267\216ACN8\354\377\277\020T\362\267D\304", <incomplete sequence \345\267>) at ../../gcc/cp/parser.c:13550 #261939 0x080b84cd in cp_parser_simple_declaration (parser=0xb7f25410, function_definition_allowed_p=<value optimized out>) at ../../gcc/cp/parser.c:8947 #261940 0x080b894a in cp_parser_block_declaration (parser=0xb7f25410, statement_p=0 '\000') at ../../gcc/cp/parser.c:8845 #261941 0x080bd9fd in cp_parser_declaration (parser=0xb7f25410) at ../../gcc/cp/parser.c:8750 #261942 0x080bd6f4 in cp_parser_declaration_seq_opt (parser=0xb7f25410) at ../../gcc/cp/parser.c:8641 #261943 0x080be25b in cp_parser_translation_unit () at ../../gcc/cp/parser.c:3091 #261944 c_parse_file () at ../../gcc/cp/parser.c:23173 #261945 0x081398f5 in c_common_parse_file (set_yydebug=0) at ../../gcc/c-opts.c:1284 #261946 0x08351693 in compile_file (argc=14, argv=0xbfffeeb4) at ../../gcc/toplev.c:1053 #261947 do_compile (argc=14, argv=0xbfffeeb4) at ../../gcc/toplev.c:2419 #261948 toplev_main (argc=14, argv=0xbfffeeb4) at ../../gcc/toplev.c:2461 #261949 0x0814014b in main (argc=14, argv=0xbfffeeb4) at ../../gcc/main.c:35