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]

[vta, trunk?] oops, one more: don't crash on ppc64's expr_lists in parallels


Almost forgot this one, it's needed for -fcompare-debug to pass on
ppc64.

rs6000 often uses expr_lists in parallels to represent the location of
return values and arguments.  GCC insn dumpers often crash dumping
such insns, because they assume the modes in the EXPR_LISTs must be
REG_NOTES, and then they try to print the mode name dereferencing an
array that doesn't cover the whole range.

I implemented a minimal fix here, just to avoid crashing, printing a
mode name if the mode of the expr_insn is not in the reg note range.
I guess it would be possible to remember whether we're within a
parallel, but I thought it was overkill.

I'm installing this in the branch.  Ok for trunk?

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* print_rtl (print_rtx): Don't assume modes in EXPR_LISTs and
	INSN_LISTs must refer to REG_NOTEs.

Index: gcc/print-rtl.c
===================================================================
--- gcc/print-rtl.c.orig	2008-09-03 01:20:37.000000000 -0300
+++ gcc/print-rtl.c	2008-10-01 16:08:16.000000000 -0300
@@ -208,7 +208,9 @@ print_rtx (const_rtx in_rtx)
 	  if (GET_CODE (in_rtx) == EXPR_LIST
 	      || GET_CODE (in_rtx) == INSN_LIST)
 	    fprintf (outfile, ":%s",
-		     GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
+		     (int)GET_MODE (in_rtx) >= REG_NOTE_MAX
+		     ? GET_MODE_NAME (GET_MODE (in_rtx))
+		     : GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
 
 	  /* For other rtl, print the mode if it's not VOID.  */
 	  else if (GET_MODE (in_rtx) != VOIDmode)
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member       ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}

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