Breakpoint 1, fancy_abort ( file=0x4000000000c7c9c8 "/net/gnu-13/export/gnu/src/gcc/gcc/gcc/function.c", line=3943, function=0x4000000000c7cd40 "prepare_function_start") at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/diagnostic.c:654 f 1654 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) f 1 #1 0x400000000043aae0 in prepare_function_start () at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/function.c:3943 3943 gcc_assert (!rtl.emit.x_last_insn); (gdb) rtl.emit.x_last_insn is set from (gdb) bt #0 emit_barrier () at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/emit-rtl.c:3430 #1 0x400000000090a630 in ia64_output_mi_thunk (file=0x6000000000188870, thunk=<value optimized out>, delta=0, vcall_offset=-24, function=0x2000000004e09110) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/config/ia64/ia64.c:9684 #2 0x40000000001467e0 in use_thunk (thunk_fndecl=0x2000000004ac27d0, emit_p=<value optimized out>) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/cp/method.c:443 #3 0x4000000000155a90 in emit_associated_thunks (fn=<value optimized out>) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/cp/semantics.c:3157 #4 0x40000000009173d0 in cgraph_expand_function (node=0x2000000004da3f00) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/cgraphunit.c:1156 #5 0x400000000091bfc0 in cgraph_optimize () at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/cgraphunit.c:1220 #6 0x40000000000c1350 in cp_write_global_declarations () at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/cp/decl2.c:3471 #7 0x4000000000630280 in toplev_main (argc=<value optimized out>, argv=<value optimized out>) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/toplev.c:971 #8 0x40000000002336f0 in main (argc=12, argv=0x60000fffffffb6f8) at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/main.c:35
Bad revision is at http://gcc.gnu.org/ml/gcc-cvs/2008-04/msg00011.html
I am testing this patch: --- function.c.foo 2008-04-01 17:40:49.000000000 -0700 +++ function.c 2008-04-01 21:34:20.000000000 -0700 @@ -3940,7 +3940,7 @@ push_struct_function (tree fndecl) static void prepare_function_start (void) { - gcc_assert (!rtl.emit.x_last_insn); + gcc_assert (!rtl.emit.sequence_stack || !rtl.emit.x_last_insn); init_emit (); init_varasm_status (); init_expr ();
Subject: Re: New: [4.4 Regression] Revision 133787 breaks ia64 Hi, I've added the assert to check that we don't initialize RTL world twice without freeing it first (and thus that we don't leak memory). This seems to be the case. Naively, something like this should fix it. I am building a cross and will try to reproduce it. Index: config/ia64/ia64.c =================================================================== *** config/ia64/ia64.c (revision 133785) --- config/ia64/ia64.c (working copy) *************** ia64_output_mi_thunk (FILE *file, tree t *** 9694,9699 **** --- 9694,9700 ---- final_start_function (insn, file, 1); final (insn, file, 1); final_end_function (); + free_after_compilation (cfun); reload_completed = 0; epilogue_completed = 0;
I think PR35801 is the same problem on powerpc-apple-darwin9.
(In reply to comment #3) > Subject: Re: New: [4.4 Regression] Revision 133787 breaks ia64 > > Hi, > I've added the assert to check that we don't initialize RTL world twice > without freeing it first (and thus that we don't leak memory). This > seems to be the case. Naively, something like this should fix it. > I am building a cross and will try to reproduce it. > > Index: config/ia64/ia64.c > =================================================================== > *** config/ia64/ia64.c (revision 133785) > --- config/ia64/ia64.c (working copy) > *************** ia64_output_mi_thunk (FILE *file, tree t > *** 9694,9699 **** > --- 9694,9700 ---- > final_start_function (insn, file, 1); > final (insn, file, 1); > final_end_function (); > + free_after_compilation (cfun); > > reload_completed = 0; > epilogue_completed = 0; > This patch works.
Subject: Re: [4.4 Regression] Revision 133787 breaks ia64 hubicka at ucw dot cz wrote: > *************** ia64_output_mi_thunk (FILE *file, tree t > final_end_function (); > + free_after_compilation (cfun); The patch is OK. But won't all targets that have similar code need the same fix? If I cd to the config dir, and try "grep final_end_function */*" it looks like alpha, ia64, m68k, mips, rs6000, score (both score3 and score7), sh, and sparc all have the same problem. The rs6000 port has already been fixed via PR 35801. We have an ia64 patch here. We also need patches for the rest. Jim
Subject: Re: [4.4 Regression] Revision 133787 breaks ia64 > The patch is OK. > > But won't all targets that have similar code need the same fix? If I cd > to the config dir, and try "grep final_end_function */*" it looks like > alpha, ia64, m68k, mips, rs6000, score (both score3 and score7), sh, and > sparc all have the same problem. The rs6000 port has already been fixed > via PR 35801. We have an ia64 patch here. We also need patches for the > rest. Thanks, I've just noticed that too and send patch for all the backends. Looks like we was leaking memory here for ages, probably not that big deal since thunks are pretty small functions, but still keeping all the RTL register tables around seems bit expensive. Honza > > Jim > > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35795 > > ------- You are receiving this mail because: ------- > You are on the CC list for the bug, or are watching someone who is.
Subject: Bug 35795 Author: hjl Date: Thu Apr 3 12:49:27 2008 New Revision: 133868 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133868 Log: 2008-04-03 Jan Hubicka <jh@suse.cz> PR tree-optimization/35795 * alpha/alpha.c (alpha_output_mi_thunk_osf): Free after compilation. * sparc/sparc.c (sparc_output_mi_thunk): Likewise. * ia64/ia64.c (ia64_output_mi_thunk): Likewise. * m68k/m68k.c (m68k_output_mi_thunk): Likewise. * score/score3.c (score3_output_mi_thunk): Likewise. * score/score7.c (score7_output_mi_thunk): Likewise. * mips/mips.c (mips_output_mi_thunk): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/config/alpha/alpha.c trunk/gcc/config/ia64/ia64.c trunk/gcc/config/m68k/m68k.c trunk/gcc/config/mips/mips.c trunk/gcc/config/score/score3.c trunk/gcc/config/score/score7.c trunk/gcc/config/sparc/sparc.c
I am pretty sure I saw this one targeting sparc-rtems. Building an updated tree now to confirm it is the fix. ../../../../gcc/libstdc++-v3/src/iostream-inst.cc: In member function 'void std::basic_iostream<char, std::char_traits<char> >::_ZThn8_NSdD1Ev()': ../../../../gcc/libstdc++-v3/src/iostream-inst.cc:51: internal compiler error: in prepare_function_start, at function.c:3940
Subject: Re: [4.4 Regression] Revision 133787 breaks ia64 > I am pretty sure I saw this one targeting sparc-rtems. Building an updated > tree now to confirm it is the fix. > > ../../../../gcc/libstdc++-v3/src/iostream-inst.cc: In member function 'void > std::basic_iostream<char, std::char_traits<char> >::_ZThn8_NSdD1Ev()': > ../../../../gcc/libstdc++-v3/src/iostream-inst.cc:51: internal compiler error: > in prepare_function_start, at function.c:3940 sparc, alpha, m68k, score and mips contained same problem, so hopefully it is fixed now. Honza
(In reply to comment #10) > Subject: Re: [4.4 Regression] Revision 133787 breaks ia64 > > > I am pretty sure I saw this one targeting sparc-rtems. Building an updated > > tree now to confirm it is the fix. > > > > ../../../../gcc/libstdc++-v3/src/iostream-inst.cc: In member function 'void > > std::basic_iostream<char, std::char_traits<char> >::_ZThn8_NSdD1Ev()': > > ../../../../gcc/libstdc++-v3/src/iostream-inst.cc:51: internal compiler error: > > in prepare_function_start, at function.c:3940 > > sparc, alpha, m68k, score and mips contained same problem, so hopefully > it is fixed now. My sparc build is past this point now so I think it is fixed there.
Fixed.