[PATCH v2] Fix use of singleton in optinfo framework

Jakub Jelinek jakub@redhat.com
Wed Apr 15 13:22:55 GMT 2020


On Tue, Apr 07, 2020 at 11:12:48PM -0400, 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 and when its dtor
> is called it calls delete on uninitialized data, causing an ICE.

To be precise, there is nothing wrong in the code, dump_context ()
is value initialization which should zero initialize the whole temporary.
It is only because GCC 4.2 is buggy, see PR33916, that it doesn't do that.

There is no reason to value-initialize anything in this case though, so
your patch works around the GCC 4.2 bug by doing the right thing.

I've fixed your ChangeLog entry (both that there is no : in between filename
and ( and to adjust the comment on what changed, because Fix ctor implies
that there was a bug in the code, which is not the case here
and committed to trunk for you.

Thanks.

	Jakub



More information about the Gcc-patches mailing list