public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* haifa buffer overflow
@ 1997-10-01 17:45 Richard Henderson
  1997-10-07 10:27 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 1997-10-01 17:45 UTC (permalink / raw)
  To: egcs

The debugging dumps from haifa overflow the alloca'd buffer
on Alpha, doing Bad Things to the stack.  Since there's no
reason to go through such a buffer at all, I have it print
directly.


r~



Wed Oct  1 17:41:09 1997  Richard Henderson  <rth@cygnus.com>

	* haifa-sched.c (print_block_visualization): fprintf directly, don't
	sprintf through an alloca'ed buffer.

Index: haifa-sched.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/haifa-sched.c,v
retrieving revision 1.14
diff -u -p -d -r1.14 haifa-sched.c
--- haifa-sched.c	1997/09/22 17:41:37	1.14
+++ haifa-sched.c	1997/10/02 00:41:30
@@ -6329,27 +6329,24 @@ print_block_visualization (b, s)
      char *s;
 {
   int unit, i;
-  char *names;			/* names of units */
-  char *delim;			/* separation line */
 
   /* print header */
   fprintf (dump, "\n;;   ==================== scheduling visualization for block %d %s \n", b, s);
 
   /* Print names of units */
-  names = (char *) alloca (256);
-  delim = (char *) alloca (256);
-  sprintf (names, ";;   %-8s", "clock");
-  sprintf (delim, ";;   %-8s", "=====");
+  fprintf (dump, ";;   %-8s", "clock");
   for (unit = 0; unit < FUNCTION_UNITS_SIZE; unit++)
     if (function_units[unit].bitmask & target_units)
       for (i = 0; i < function_units[unit].multiplicity; i++)
-	{
-	  sprintf (names + strlen (names), "  %-33s", function_units[unit].name);
-	  sprintf (delim + strlen (delim), "  %-33s", "==============================");
-	}
-  sprintf (names + strlen (names), "  %-8s", "no-unit");
-  sprintf (delim + strlen (delim), "  %-8s", "=======");
-  fprintf (dump, "\n%s\n%s\n", names, delim);
+	fprintf (dump, "  %-33s", function_units[unit].name);
+  fprintf (dump, "  %-8s\n", "no-unit");
+
+  fprintf (dump, ";;   %-8s", "=====");
+  for (unit = 0; unit < FUNCTION_UNITS_SIZE; unit++)
+    if (function_units[unit].bitmask & target_units)
+      for (i = 0; i < function_units[unit].multiplicity; i++)
+	fprintf (dump, "  %-33s", "==============================");
+  fprintf (dump, "  %-8s\n", "=======");
 
   /* Print insns in each cycle */
   fprintf (dump, "%s\n", visual_tbl);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: haifa buffer overflow
  1997-10-01 17:45 haifa buffer overflow Richard Henderson
@ 1997-10-07 10:27 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1997-10-07 10:27 UTC (permalink / raw)
  To: rth; +Cc: egcs

  In message < 199710020044.RAA18118@dot.cygnus.com >you write:
  > The debugging dumps from haifa overflow the alloca'd buffer
  > on Alpha, doing Bad Things to the stack.  Since there's no
  > reason to go through such a buffer at all, I have it print
  > directly.
Thanks.  I hit this a few months ago and forgot about it and thus
never went looking for it (all I knew was we had a buffer overrun
somewhere in the debug code).

I've installed this into egcs.
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-10-07 10:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-01 17:45 haifa buffer overflow Richard Henderson
1997-10-07 10:27 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).