Compilation of the attached testcase hangs in 0x000000000056aedc in cp_print_error_function (context=0x15c5a60, diagnostic=0x7fff955f6c30) at /space/rguenther/src/svn/trunk/gcc/cp/error.c:2426 2426 while (TREE_CODE (ao) == BLOCK && BLOCK_ABSTRACT_ORIGIN (ao)) 2427 ao = BLOCK_ABSTRACT_ORIGIN (ao); because BLOCK_ABSTRACT_ORIGIN (ao) == ao. If you build with -O2 -g. Building without -g fixes the problem (possibly the BLOCK is thrown away as unused).
Created attachment 14967 [details] reduced testcase
The recursion is created by set_block_origin_self (), called from #0 set_block_origin_self (stmt=0x2b4ce448cd80) at /space/rguenther/src/svn/trunk/gcc/integrate.c:105 #1 0x000000000098ca87 in set_decl_origin_self (decl=0x2b4ce4479680) at /space/rguenther/src/svn/trunk/gcc/integrate.c:154 #2 0x0000000000810f41 in gen_decl_die (decl=0x2b4ce4479680, context_die=0x2b4ce445e0c0) at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:13873 #3 0x00000000008129d3 in dwarf2out_decl (decl=0x2b4ce4479680) at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:14214 #4 0x00000000008880c7 in rest_of_handle_final () at /space/rguenther/src/svn/trunk/gcc/final.c:4152 while we still (after that), try to emit diagnostics via #0 0x000000000056ae92 in cp_print_error_function (context=0x15c5a60, diagnostic=0x7fffc70736b0) at /space/rguenther/src/svn/trunk/gcc/cp/error.c:2426 #1 0x000000000056a9f4 in cp_diagnostic_starter (context=0x15c5a60, diagnostic=0x7fffc70736b0) at /space/rguenther/src/svn/trunk/gcc/cp/error.c:2364 #2 0x00000000007e2168 in diagnostic_report_diagnostic (context=0x15c5a60, diagnostic=0x7fffc70736b0) at /space/rguenther/src/svn/trunk/gcc/diagnostic.c:421 #3 0x00000000007e25e4 in warning (opt=0, gmsgid=0x112a8e8 "%Kcall to %qs declared with attribute warning: %s") at /space/rguenther/src/svn/trunk/gcc/diagnostic.c:511 #4 0x0000000000866d15 in expand_expr_real_1 (exp=0x2b4ce44e5230, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /space/rguenther/src/svn/trunk/gcc/expr.c:8043 #5 0x000000000085ff13 in expand_expr_real (exp=0x2b4ce44e5230, target=0x2b4ce3a92400, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /space/rguenther/src/svn/trunk/gcc/expr.c:7094 #6 0x0000000000a95a45 in expand_expr (exp=0x2b4ce44e5230, target=0x2b4ce3a92400, mode=VOIDmode, modifier=EXPAND_NORMAL) at /space/rguenther/src/svn/trunk/gcc/expr.h:514 #7 0x0000000000a977db in expand_expr_stmt (exp=0x2b4ce44e5230) at /space/rguenther/src/svn/trunk/gcc/stmt.c:1361 #8 0x0000000000fd8e9a in expand_gimple_basic_block (bb=0x2b4ce44c8f00) at /space/rguenther/src/svn/trunk/gcc/cfgexpand.c:1609 #9 0x0000000000fda700 in tree_expand_cfg () at /space/rguenther/src/svn/trunk/gcc/cfgexpand.c:1918 thus from expanding another function. Bummer.
I have a patch.
Fixed.
Subject: Bug 34850 Author: rguenth Date: Mon Jan 21 09:34:19 2008 New Revision: 131690 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131690 Log: 2008-01-21 Richard Guenther <rguenther@suse.de> PR c++/34850 cp/ * error.c (cp_print_error_function): Deal with recursive BLOCK trees. * g++.dg/torture/pr34850.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/torture/pr34850.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/error.c trunk/gcc/testsuite/ChangeLog