From:	CSBVAX::MRGATE!grunwald%guitar.cs.uiuc.edu@a.cs.uiuc.edu@SMTP 19-JUL-1988 21:41
To:	ARISIA::EVERHART
Subj:	Error in GDB: coffread.c


Received: from A.CS.UIUC.EDU by prep.ai.mit.edu; Tue, 19 Jul 88 13:35:26 EST
Received: from guitar.cs.uiuc.edu by a.cs.uiuc.edu with SMTP (UIUC-5.52/9.7)
	id AA17919; Tue, 19 Jul 88 13:54:58 CDT
Received: by guitar.cs.uiuc.edu (3.2/9.6),
	id AA24776; Tue, 19 Jul 88 13:54:05 CDT
Date: Tue, 19 Jul 88 13:54:05 CDT
From: grunwald%guitar.cs.uiuc.edu@a.cs.uiuc.edu (Dirk Grunwald)
Message-Id: <8807191854.AA24776@guitar.cs.uiuc.edu>
To: info-gdb@prep.ai.mit.edu, info-gcc@prep.ai.mit.edu
Subject: Error in GDB: coffread.c
Office: 72 DCL (217) 333-1925
Reply-To: grunwald%guitar.cs.uiuc.edu@a.cs.uiuc.edu


Pardon the possible double posting, but I'm not completely certain there
is an info-gdb.

There is an error in file ``coffread.c'' in GDB V 2.6. I encounted this
problem when I was using GDB on a very large file (parallel gnumake)
on an Encore multimax. The fix is simple, and once it is applied,
GDB was able to run with no problems. If someone with god-like knowledge
concerning COFF can bless this fix, I'd feel happier.

The following are context diffs with GDB V2.6.

Dirk Grunwald
Univ. of Illinois
grunwald@m.cs.uiuc.edu

*** coffread.c	Sat May  7 23:19:32 1988
--- /tmp/coffread.c	Tue Jul 19 13:51:26 1988
***************
*** 32,37 ****
--- 32,38 ----
  #include <obstack.h>
  #include <sys/param.h>
  #include <sys/file.h>
+ #include <assert.h>
  
  static void add_symbol_to_list ();
  static void read_coff_symtab ();
***************
*** 184,196 ****
  {
    if (index >= type_vector_length)
      {
        type_vector_length *= 2;
        type_vector = (struct typevector *)
  	xrealloc (type_vector, sizeof (struct typevector)
  				+ type_vector_length * sizeof (struct type *));
!       bzero (&type_vector->type[type_vector_length / 2],
! 	     type_vector_length * sizeof (struct type *) / 2);
      }
    return &type_vector->type[index];
  }
  
--- 185,203 ----
  {
    if (index >= type_vector_length)
      {
+       int old_vector_length = type_vector_length;
+ 
        type_vector_length *= 2;
+       if (type_vector_length < index) {
+ 	type_vector_length = index * 2;
+       }
        type_vector = (struct typevector *)
  	xrealloc (type_vector, sizeof (struct typevector)
  				+ type_vector_length * sizeof (struct type *));
!       bzero (&type_vector->type[ old_vector_length ],
! 	     (type_vector_length - old_vector_length) * sizeof(struct type *));
      }
+   assert( index < type_vector_length );
    return &type_vector->type[index];
  }
  
