[PATCH] Fix use of singleton in optinfo framework

Hans-Peter Nilsson hp@bitrange.com
Tue Apr 14 03:33:55 GMT 2020


On Mon, 6 Apr 2020, Gustavo Romero via Gcc-patches wrote:

> Currently an use of get() method of dump_context singleton in optinfo
> framework causes a new class to be instantiated, which calls the singleton
> dtor when the class is destroyed, freeing memory that is referenced after
> free() is called, generating an ICE error.
>
> This commit fixes the issue by using singleton's static member get()
> directly to get the singleton's active instance, which doesn't instantiate
> a new class, so no dtor is called.
>
> gcc/Changelog:
> 2020-04-06  Gustavo Romero  <gromero@linux.ibm.com>
>
> 	* dumpfile.c:
> 	(selftest::temp_dump_context::temp_dump_context): Fix ctor.

Better formatted ChangeLogentry; removing ":" (and breaking at
column 70 seems better than after with leaving a single word on
the next line):

 	* dumpfile.c (selftest::temp_dump_context::temp_dump_context):
	Fix ctor.

Sadly this patch doesn't fix PR bootstrap/87252; I just checked
against f8e72b8d9f2:f81653ba8c1:2dd4ceacd8b (truncated from
LAST_UPDATED; I don't remember which field is the actual
commit).

brgds, H-P


More information about the Gcc-patches mailing list