Fix sched-vis.c array bounds exceeded.

Graham Stott grahams@redhat.com
Thu Apr 5 12:34:00 GMT 2001


All

I was working on a port which required some asms to have a large
number of clobbers and this caused this caused an array bound
to be exceeded in sched-vis.c when compiling with -da.

The patch introduces a new macro and also increases the size
of the vis_no_unit array to 20 which should be more than enough.

Note I will be out of the office for the next 3 weeks and won't be
able to commit this myself until I return.

Graham

This patch is against the trunk.

ChangeLog

2001-04-05  Graham Stott  <grahams@redhat.com>

	* sched-vis.c (MAX_VISUAL_NO_UNIT): Define.
	(vis_no_unit): Use it.
	(visualize_no_unit): Add the insn only if room exists. 
 
-------------------------------------------------------------------
Index: sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.6
diff -c -p -r1.6 sched-vis.c
*** sched-vis.c 2001/04/03 15:05:28     1.6
--- sched-vis.c 2001/04/05 19:15:03
*************** int n_visual_lines;
*** 87,93 ****
  static unsigned visual_tbl_line_length;
  char *visual_tbl;
  int n_vis_no_unit;
! rtx vis_no_unit[10];

  /* Finds units that are in use in this fuction.  Required only
     for visualization.  */
--- 87,94 ----
  static unsigned visual_tbl_line_length;
  char *visual_tbl;
  int n_vis_no_unit;
! #define MAX_VISUAL_NO_UNIT 20
! rtx vis_no_unit[MAX_VISUAL_NO_UNIT];

  /* Finds units that are in use in this fuction.  Required only
     for visualization.  */
*************** void
*** 844,851 ****
  visualize_no_unit (insn)
       rtx insn;
  {
!   vis_no_unit[n_vis_no_unit] = insn;
!   n_vis_no_unit++;
  }

  /* Print insns scheduled in clock, for visualization.  */
--- 845,855 ----
  visualize_no_unit (insn)
       rtx insn;
  {
!   if (n_vis_no_unit < MAX_VISUAL_NO_UNIT)
!     {
!       vis_no_unit[n_vis_no_unit] = insn;
!       n_vis_no_unit++;
!     }
  }

  /* Print insns scheduled in clock, for visualization.  */
---------------------------------------------------------------



More information about the Gcc-patches mailing list