From: Peter.Wemm@zeus.dialix.oz.AU (Peter Wemm)
Subject: Suggested fixes for g++-2.2.2 on SVR4 with -g
Reply-To: Peter.Wemm@zeus.dialix.oz.au
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 30 Jul 1992 17:20:09 GMT

I have been asked to send some patches that (hopefully) fix some of 
the more serious problems in gcc 2.2.2 in C++ mode that are specific
to SVR4 with -g.

I believe parts of these patches have been posted before, but there is
some doubt about how far they were distributed.

These are not my patches,  Ron Guilmette <rfg@ncd.com> deserves the
credit for this.

diff -prc2 2.2.2-/cp-decl.c 2.2.2+/cp-decl.c
*** 2.2.2-/cp-decl.c	Wed Jun 10 21:14:00 1992
--- 2.2.2+/cp-decl.c	Sun Jul 26 15:32:49 1992
*************** grokdeclarator (declarator, declspecs, d
*** 6216,6220 ****
    enum tree_code innermost_code = ERROR_MARK;
    int bitfield = 0;
!   int variable_size = 0;
    /* Set this to error_mark_node for FIELD_DECLs we could not handle properly.
       All FIELD_DECLs we build here have `init' put into their DECL_INITIAL.  */
--- 6216,6220 ----
    enum tree_code innermost_code = ERROR_MARK;
    int bitfield = 0;
!   int size_varies = 0;
    /* Set this to error_mark_node for FIELD_DECLs we could not handle properly.
       All FIELD_DECLs we build here have `init' put into their DECL_INITIAL.  */
*************** grokdeclarator (declarator, declspecs, d
*** 7086,7089 ****
--- 7086,7093 ----
  		  dont_grok_size:
  		    itype = build_binary_op (MINUS_EXPR, size, integer_one_node);
+ 		    /* Make sure the array size remains visibly nonconstant
+ 		       even if it is (eg) a const variable with known value.  */
+ 		    size_varies = 1;
+ 		    itype = variable_size (itype);
  		    itype = build_index_type (itype);
  		  }
diff -prc2 2.2.2-/dwarfout.c 2.2.2+/dwarfout.c
*** 2.2.2-/dwarfout.c	Sat May 30 22:08:49 1992
--- 2.2.2+/dwarfout.c	Sun Jul 26 15:42:38 1992
*************** output_mem_loc_descriptor (rtl)
*** 1303,1308 ****
  
  	ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_BASEREG);
!         ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
! 				DBX_REGISTER_NUMBER (REGNO (rtl)));
  	break;
  
--- 1303,1311 ----
  
  	ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_BASEREG);
! 	if (is_pseudo_reg (rtl))
!           ASM_OUTPUT_DWARF_DATA4 (asm_out_file, (unsigned) -1);
! 	else
!           ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
! 				  DBX_REGISTER_NUMBER (REGNO (rtl)));
  	break;
  
*************** output_loc_descriptor (rtl)
*** 1359,1364 ****
      case REG:
  	ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_REG);
!         ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
! 				DBX_REGISTER_NUMBER (REGNO (rtl)));
  	break;
  
--- 1362,1370 ----
      case REG:
  	ASM_OUTPUT_DWARF_STACK_OP (asm_out_file, OP_REG);
! 	if (is_pseudo_reg (rtl))
!           ASM_OUTPUT_DWARF_DATA4 (asm_out_file, (unsigned) -1);
! 	else
!           ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
! 				  DBX_REGISTER_NUMBER (REGNO (rtl)));
  	break;
  
*************** output_decl (decl, containing_scope)
*** 3819,3823 ****
  
  	  if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
! 	    arg_decls = TREE_CHAIN (arg_decls);
  
  	  {
--- 3825,3829 ----
  
  	  if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE)
! 	    arg_decls = arg_decls ? TREE_CHAIN (arg_decls) : NULL_TREE;
  
  	  {
*************** dwarfout_file_scope_decl (decl, set_fina
*** 4098,4107 ****
       don't carry their own sequence numbers with them!)  */
  
!   if (DECL_IGNORED_P (decl))
!     {
!       if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
! 	abort ();
!       return;
!     }
  
    switch (TREE_CODE (decl))
--- 4104,4109 ----
       don't carry their own sequence numbers with them!)  */
  
!   if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
!     return;
  
    switch (TREE_CODE (decl))




-- 
Peter Wemm : peter@zeus.dialix.oz.au     If it's broke, fix it (The MS-DOS way)
Work phone: +61-9-479-1855      If it aint broke, don't touch it (The Unix way)
Fax: +61-9-479-1134     If we can't fix it, it ain't broke (Maintainer's Motto)
  "Don't give me that intelligent life cr*p, find me something to blow up!"

Newsgroups: gnu.g++.bug