[PATCH] Fix PR65538
Martin Liška
mliska@suse.cz
Wed Mar 25 10:54:00 GMT 2015
On 03/25/2015 12:37 AM, Jan Hubicka wrote:
>> On Tue, Mar 24, 2015 at 10:54:25PM +0100, Martin Liška wrote:
>>> --- a/gcc/symbol-summary.h
>>> +++ b/gcc/symbol-summary.h
>>> @@ -81,6 +81,12 @@ public:
>>> m_symtab_insertion_hook = NULL;
>>> m_symtab_removal_hook = NULL;
>>> m_symtab_duplication_hook = NULL;
>>> +
>>> + /* Release all summaries in case we use non-GGC memory. */
>>> + typedef typename hash_map <int, T *, summary_hashmap_traits>::iterator map_iterator;
>>> + if (!m_ggc)
>>> + for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
>>> + release ((*it).second);
>>
>> You haven't removed the now unnecessary if (!m_ggc) guard.
>>
>>> @@ -106,6 +112,15 @@ public:
>>> return m_ggc ? new (ggc_alloc <T> ()) T() : new T () ;
>>> }
>>>
>>> + /* Release an item that is stored within map. */
>>> + void release (T *item)
>>> + {
>>> + if (m_ggc)
>>> + ggc_free (item);
>>
>> Perhaps run also the item's destructor first? I know that
>> inline_summary doesn't have a user destructor, so it will expand to nothing,
>> so it would be just for completeness.
>
> Yep, calling destructors is a good idea. OK with that change
> and fix Jakub pointed out.
>
> Honza
>>
>>> + else
>>> + delete item;
>>> + }
>>> +
>>
>> Jakub
Ok, changes are applied in the final patch I'm going to install.
Thanks,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-PR65538.patch
Type: text/x-patch
Size: 1443 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150325/72ebe4c9/attachment.bin>
More information about the Gcc-patches
mailing list