[PATCH] New fixes for hot/cold partitioning

Caroline Tice ctice@apple.com
Wed Apr 6 22:32:00 GMT 2005


On Apr 6, 2005, at 3:12 PM, Zack Weinberg wrote:

> Caroline Tice <ctice@apple.com> writes:
>
>> !       cfun = DECL_STRUCT_FUNCTION (current_function_decl);
>> !       if (!cfun->unlikely_text_section_name)
>>   	{
>> ! 	  if (flag_function_sections
>> ! 	      && DECL_SECTION_NAME (current_function_decl))
>> ! 	    {
>> ! 	      name = xstrdup (TREE_STRING_POINTER (DECL_SECTION_NAME
>> ! 						   (current_function_decl)));
>> ! 	      stripped_name = targetm.strip_name_encoding (name);
>> ! 	      len = strlen (stripped_name);
>> ! 	      buffer = (char *) xmalloc (len + 10);
>> ! 	      sprintf (buffer, "%s%s", stripped_name, "_unlikely");
>> ! 	      cfun->unlikely_text_section_name = ggc_strdup (buffer);
>> ! 	      free (buffer);
>> ! 	      free (name);
>> ! 	      free (strippped_name);
>> ! 	    }
>
> It is not correct to free stripped_name.  Most
> targetm.strip_name_encoding definitions modify their argument in
> place.  You should have checked this yourself.
>
>

Mea culpa.  I'm sorry.  If I remove that statement, and this revised
patch passes all the tests, is this okay to commit?

-- Caroline
ctice@apple.com



More information about the Gcc-patches mailing list