This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] SH: Bootstrap failure


Mainline fails to build libstdc++-v3 for sh4-unknown-linux-gnu:

../../../../ORIG/gcc/libstdc++-v3/src/ In member function 'void std::strstream::_ZTv0_n12_NSt9strstreamD0Ev()':
../../../../ORIG/gcc/libstdc++-v3/src/ internal compiler error: Segmentation fault

The recent Honza's patch

intializes cfun->cfg in init_flow instead of allocate_struct_function.
sh_output_mi_thunk and dbr_schedule called from it access the variables
like basic_block_info and n_basic_block which are members of the struct
*cfun->cfg prior to calling init_flow and this causes segfaults.
The appended patch is to fix it.  The second hunk of the patch calls
find_basic_blocks to set n_basic_block correctly.
It's tested with bootstrap and the toplevel "make -k check" on
sh4-unknown-linux-gnu.  I saw some new failures in c and java tests,
but they are seen also on the other targets in gcc-testresult list
and would be irrelevant to the patch.  Ok for mainline?

2005-05-13  Kaz Kojima  <>

	* config/sh/sh.c (sh_output_mi_thunk): Check cfun->cfg instead
	of basic_block_info.  Call init_flow and find_basic_blocks
	before dbr_schedule if needed.

diff -uprN ORIG/gcc/gcc/config/sh/sh.c LOCAL/gcc/gcc/config/sh/sh.c
--- ORIG/gcc/gcc/config/sh/sh.c	2005-05-13 09:27:04.000000000 +0900
+++ LOCAL/gcc/gcc/config/sh/sh.c	2005-05-13 13:00:08.000000000 +0900
@@ -10301,7 +10301,7 @@ sh_output_mi_thunk (FILE *file, tree thu
       /* Initialize the bitmap obstacks.  */
       bitmap_obstack_initialize (NULL);
       bitmap_obstack_initialize (&reg_obstack);
-      if (! basic_block_info)
+      if (! cfun->cfg)
 	init_flow ();
       rtl_register_cfg_hooks ();
       find_basic_blocks (insns);
@@ -10315,7 +10315,14 @@ sh_output_mi_thunk (FILE *file, tree thu
   sh_reorg ();
   if (optimize > 0 && flag_delayed_branch)
-    dbr_schedule (insns, dump_file);
+    {
+      if (! cfun->cfg)
+	{
+	  init_flow ();
+	  find_basic_blocks (insns);
+	}
+      dbr_schedule (insns, dump_file);
+    }
   shorten_branches (insns);
   final_start_function (insns, file, 1);
   final (insns, file, 1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]