Fix for v850 port calling ggc_alloc_string with NULL

Nick Clifton nickc@redhat.com
Fri Jan 5 15:23:00 GMT 2001


Hi Guys,

  ggc_alloc_string can no longer be called with a NULL contents
  parameter.  I have applied the patch below to prevent the v850 port
  from doing this.

Cheers
	Nick

2001-01-05  Nick Clifton  <nickc@redhat.com>

	* config/v850/v850.c (v850_encode_data_area): Use alloca to create
	temporary string for initialisation before calling ggc_alloc_string.

Index: config/v850/v850.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/v850/v850.c,v
retrieving revision 1.112
diff -p -r1.112 v850.c
*** v850.c	2000/12/24 21:20:36	1.112
--- v850.c	2001/01/05 23:21:40
*************** v850_encode_data_area (decl)
*** 2246,2252 ****
  	return;
      }
  
!   newstr = ggc_alloc_string (NULL, len + 2);
  
    strcpy (newstr + 1, str);
  
--- 2246,2252 ----
  	return;
      }
  
!   newstr = alloca (len + 2);
  
    strcpy (newstr + 1, str);
  
*************** v850_encode_data_area (decl)
*** 2258,2264 ****
      default: abort ();
      }
  
!   XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
  }
  
  /* Return true if the given RTX is a register which can be restored
--- 2258,2264 ----
      default: abort ();
      }
  
!   XSTR (XEXP (DECL_RTL (decl), 0), 0) = ggc_alloc_string (newstr, len + 2);
  }
  
  /* Return true if the given RTX is a register which can be restored


More information about the Gcc-patches mailing list