This is the mail archive of the gcc-patches@gcc.gnu.org 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]: Fix PR target/29794 - [4.2/4.3 Regression] cc1 segfaults with -O3 -msched-control-spec


Hi!

This patch fixes PR target/29794 on ia64.

The bug is due to wrong loop variable initialization. This results in use of out-of-bounds index and subsequent segmentation fault. The obvious patch is attached.

OK for trunk and gcc-4_2-branch?


Thanks, Maxim

2006-11-20  Maxim Kuvyrkov  <mkuvyrkov@ispras.ru>

	PR target/29794
	* sched-rgn.c (add_block1): Use correct initializer.
--- sched-rgn.c	(/gcc-local/trunk/gcc)	(revision 23010)
+++ sched-rgn.c	(/gcc-local/fix-pr29794/gcc)	(revision 23010)
@@ -3147,9 +3147,15 @@ add_block1 (basic_block bb, basic_block 
 	 is _always_ valid for access.  */
 
       i = BLOCK_TO_BB (after->index) + 1;
-      for (pos = ebb_head[i]; rgn_bb_table[pos] != after->index; pos--);
+      pos = ebb_head[i] - 1;
+      /* Now POS is the index of the last block in the region.  */
+
+      /* Find index of basic block AFTER.  */
+      for (; rgn_bb_table[pos] != after->index; pos--);
+
       pos++;
       gcc_assert (pos > ebb_head[i - 1]);
+
       /* i - ebb right after "AFTER".  */
       /* ebb_head[i] - VALID.  */
 

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