My patch to fix a memory leak with target_globals accidentally
introduced a double destructor call for default_target_ira. Normally
this was benign because free_register_move_costs clears the freed
pointers afterwards. However, with LTO -O3 that clearing could get
inlined into the destructor and removed as dead, leading to a double free.
Tested on aarch64-elf and applied as obvious.
Thanks,
Richard
gcc/
PR bootstrap/63280
* target-globals.c (target_globals::~target_globals): Fix location
of ira_int destruction.
Index: gcc/target-globals.c
===================================================================
--- gcc/target-globals.c 2014-09-22 08:37:01.421320931 +0100
+++ gcc/target-globals.c 2014-09-23 15:44:48.951451849 +0100
@@ -121,10 +121,10 @@ save_target_globals_default_opts ()
target_globals::~target_globals ()
{
- ira_int->~target_ira_int ();
/* default_target_globals points to static data so shouldn't be freed. */
if (this != &default_target_globals)
{
+ ira_int->~target_ira_int ();
hard_regs->finalize ();
XDELETE (flag_state);
XDELETE (regs);