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]

[RFA:] cfg.c:dump_flow_info: Guard against NULL regno_reg_rtx[i].


This is a ham-fisted attempt to fix the problem mentioned in
<URL:http://gcc.gnu.org/ml/gcc-patches/2002-03/msg01985.html>,
getting SEGV when compiling g++.old-deja/g++.pt/static11.C with
-da.  I assume that it's actually ok for regno_reg_rtx[i] to be
NULL here, or else there would have been one of those infamous
verify_flow_info tests for that.  Not really valid logic I
agree, but I hope some cfg-knowledgeable person will immediately
spot the bad assumption, and if so I can instead add a test to
verify_flow_info (or other appropriate code) so the real bug can
be fixed.

Only tested with -da on g++.old-deja/g++.pt/static11.C on
mmix-knuth-mmixware, since this code isn't usually executed in
neither bootstrap or checking.

	* cfg.c (dump_flow_info): Guard against NULL regno_reg_rtx[i].

Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.21
diff -u -p -r1.21 cfg.c
--- cfg.c	2002/03/11 11:10:44	1.21
+++ cfg.c	2002/03/29 22:19:03
@@ -472,7 +472,7 @@ dump_flow_info (file)
 	if (REG_N_SETS (i))
 	  fprintf (file, "; set %d time%s", REG_N_SETS (i),
 		   (REG_N_SETS (i) == 1) ? "" : "s");
-	if (REG_USERVAR_P (regno_reg_rtx[i]))
+	if (regno_reg_rtx[i] != NULL && REG_USERVAR_P (regno_reg_rtx[i]))
 	  fprintf (file, "; user var");
 	if (REG_N_DEATHS (i) != 1)
 	  fprintf (file, "; dies in %d places", REG_N_DEATHS (i));
@@ -480,7 +480,8 @@ dump_flow_info (file)
 	  fprintf (file, "; crosses 1 call");
 	else if (REG_N_CALLS_CROSSED (i))
 	  fprintf (file, "; crosses %d calls", REG_N_CALLS_CROSSED (i));
-	if (PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
+	if (regno_reg_rtx[i] != NULL
+	    && PSEUDO_REGNO_BYTES (i) != UNITS_PER_WORD)
 	  fprintf (file, "; %d bytes", PSEUDO_REGNO_BYTES (i));

 	class = reg_preferred_class (i);
@@ -497,7 +498,7 @@ dump_flow_info (file)
 		       reg_class_names[(int) altclass]);
 	  }

-	if (REG_POINTER (regno_reg_rtx[i]))
+	if (regno_reg_rtx[i] != NULL && REG_POINTER (regno_reg_rtx[i]))
 	  fprintf (file, "; pointer");
 	fprintf (file, ".\n");
       }

brgds, H-P


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