[net.bugs.4bsd] dbx dumps core on some fortran files

pag@hao.UUCP (Peter Gross) (01/22/85)

Index:	src/ucb/dbx/object.c 4.2BSD FIX

Description:
	dbx will dump core on initialization when debugging a fortran
	file that has a common block with the same name as the source
	file.
Repeat-By:
	1.  Create a file with the name "srcf.f".  Put this 3 line fortran
	file in it:
      common /srcf/ test

      stop
      end

	2.  Compile the following program with: f77 -g srcf.f
	3.  Invoke dbx: dbx a.out
	dbx will crash (bus error) and dump core.
Fix:
*** /tmp/,RCSt1020632	Mon Jan 21 16:00:47 1985
--- object.c	Mon Jan 21 15:00:24 1985
***************
*** 1,6
  /* Copyright (c) 1982 Regents of the University of California */
  
! static char sccsid[] = "@(#)object.c 1.13 8/16/83";
  
  /*
   * Object code interface, mainly for extraction of symbolic information.

--- 1,6 -----
  /* Copyright (c) 1982 Regents of the University of California */
  
! static char *rcsid = "$Header: object.c,v 1.14 85/01/21 14:58:04 pag Exp $";
  
  /*
   * Object code interface, mainly for extraction of symbolic information.
***************
*** 4,9
  
  /*
   * Object code interface, mainly for extraction of symbolic information.
   */
  
  #include "defs.h"

--- 4,16 -----
  
  /*
   * Object code interface, mainly for extraction of symbolic information.
+  *
+  * $Log:	object.c,v $
+  * Revision 1.14  85/01/21  14:58:04  pag
+  * Bug fix from Graham Murphy:  dbx would bomb on initialization when
+  * a common block name was the same as the program source file
+  * name.
+  * 
   */
  
  #include "defs.h"
***************
*** 294,300
   	    if (curcomm) {
  		curcomm->symvalue.common.chain = commchain;
  	    }
! 	    curcomm = lookup(n);
  	    if (curcomm == nil) {
  		curcomm = insert(n);
  		curcomm->class = COMMON;

--- 301,307 -----
   	    if (curcomm) {
  		curcomm->symvalue.common.chain = commchain;
  	    }
! 	    find(curcomm, n) where curcomm->class == COMMON endfind(curcomm);
  	    if (curcomm == nil) {
  		curcomm = insert(n);
  		curcomm->class = COMMON;
	If you don't know the fix, don't include this section or "Fix:".

Comments:
	Bug discovered and fixed by Graham Murphy, a visitor to HAO.

--peter gross
hao!pag