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]

JUMP_LABEL problem and patch



Combining insns can turn indirect jumps into direct jumps.  This
causes JUMP_LABELs to go stale.

The following minimal example (from the libgcj testsuite) demonstrates
the problem when compiled with -O1...

public class G19990210_1 {
  int foo() {
	try { ; } finally { ; }
	return 0;
  }
}

jc1 produces:

G19990210_1.java:17: Internal compiler error in `make_edges', at flow.c:981

The following patch solves the problem by mindlessly rebuilding the
jump labels after combine_instructions:

Index: gcc/toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.262
diff -u -r1.262 toplev.c
--- toplev.c	1999/11/25 16:58:32	1.262
+++ toplev.c	1999/11/27 23:29:05
@@ -4072,6 +4072,11 @@
     {
       TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
 
+      /* Combining insns may have turned an indirect jump into a direct
+	 jump.  Rebuild the JUMP_LABEL fields of jumping
+	 instructions.  */
+      TIMEVAR (jump_time, rebuild_jump_labels (insns));
+
       /* Dump rtl code after insn combination.  */
 
       if (combine_dump)

I realize it's unlikely that this patch will be accepted.  What
probably needs to happen is either:

	1 - conditionally run rebuild_jump_labels based on feedback
		from combine_instructions, or

	2 - attempt to keep the JUMP_LABELs up to date in the combiner,
		just like we try to keep other flow information up to
		date.  I don't know if this is possible.

Comments?

AG	

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California

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