[gnu.gcc.bug] BUGS

rfg@nsc.nsc.com (Ron Guilmette) (10/27/88)

BUGS (3) in GCC 1.30  -- suggested patches included below

In the file sdbout.c in GCC 1.30 there are three bugs.

A)	The function sdbout_syms() is declared (implicitly) extern and later
	is redeclared as static.

B)	The macro PUT_SDB_FUNCTION_START outputs a COFF symbolic declaration
	for the ".bf" (begin-function) symbol for each function, but it fails
	to actually declare the name of the function itself.

C)	In the function sdbout_end_function() the line number used in the
	call to the macro PUT_SDB_FUNCTION_END() is an absolute (file)
	line number.  What is really required by the COFF standard is a
	function-relative line number (i.e. the number of lines AFTER THE
	START OF THE CURRENT FUNCTION at which the end-of-function was
	encountered.

The following patches to sdbout.c fix all three of these bugs.

diff -rc2 1.30/sdbout.c 1.30-gnx/sdbout.c
*** 1.30/sdbout.c	Mon Sep 26 14:43:59 1988
--- 1.30-gnx/sdbout.c	Wed Oct 26 12:18:50 1988
***************
*** 44,48
  
  void sdbout_init ();
! void sdbout_syms ();
  void sdbout_symbol ();
  void sdbout_tags();

--- 44,48 -----
  
  void sdbout_init ();
! static void sdbout_syms ();
  void sdbout_symbol ();
  void sdbout_tags();
***************
*** 121,125
  
  #ifndef PUT_SDB_FUNCTION_START
! #define PUT_SDB_FUNCTION_START(LINE)		\
    fprintf (asm_out_file,			\
  	   "\t.def\t.bf;\t.val\t.;\t.scl\t101;\t.line\t%d;\t.endef\n",	\

--- 121,125 -----
  
  #ifndef PUT_SDB_FUNCTION_START
! #define PUT_SDB_FUNCTION_START(LINE,NAME)	\
    fprintf (asm_out_file,			\
  	   "\t.def\t_%s;\t.val\t_%s;\t.scl\t2;\t.type\t044;\t.endef\n", \
***************
*** 123,126
  #define PUT_SDB_FUNCTION_START(LINE)		\
    fprintf (asm_out_file,			\
  	   "\t.def\t.bf;\t.val\t.;\t.scl\t101;\t.line\t%d;\t.endef\n",	\
  	   (LINE))

--- 123,129 -----
  #define PUT_SDB_FUNCTION_START(LINE,NAME)	\
    fprintf (asm_out_file,			\
+ 	   "\t.def\t_%s;\t.val\t_%s;\t.scl\t2;\t.type\t044;\t.endef\n", \
+ 	   (NAME), (NAME));			\
+   fprintf (asm_out_file,			\
  	   "\t.def\t.bf;\t.val\t.;\t.scl\t101;\t.line\t%d;\t.endef\n",	\
  	   (LINE))
***************
*** 869,873
  {
    sdb_begin_function_line = line - 1;
!   PUT_SDB_FUNCTION_START (line);
    sdbout_parms (DECL_ARGUMENTS (current_function_decl));
    sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));

--- 872,876 -----
  {
    sdb_begin_function_line = line - 1;
!   PUT_SDB_FUNCTION_START (line, IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
    sdbout_parms (DECL_ARGUMENTS (current_function_decl));
    sdbout_reg_parms (DECL_ARGUMENTS (current_function_decl));
***************
*** 881,885
       int line;
  {
!   PUT_SDB_FUNCTION_END (line);
  
    /* Indicate we are between functions, for line-number output.  */

--- 884,888 -----
       int line;
  {
!   PUT_SDB_FUNCTION_END (line - sdb_begin_function_line);  /* relative line # */
  
    /* Indicate we are between functions, for line-number output.  */