This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jeff Law <law at redhat dot com>,David Malcolm <dmalcolm at redhat dot com>,mliska <mliska at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 May 2015 19:57:39 +0200
- Subject: Re: Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.)
- Authentication-results: sourceware.org; auth=none
- References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0 dot 1432735040 dot git dot mliska at suse dot cz> <27d56fd7847e4cf0f81b87885088235b564534e4 dot 1432735040 dot git dot mliska at suse dot cz> <1432809777 dot 12727 dot 16 dot camel at surprise> <55674B1C dot 1080406 at redhat dot com>
On May 28, 2015 7:06:36 PM GMT+02:00, Jeff Law <law@redhat.com> wrote:
>On 05/28/2015 04:42 AM, David Malcolm wrote:
>>
>> Am I right in thinking that this is a statically-allocated object
>with a
>> non-trivial constructor? i.e. that this constructor has to run
>before
>> "main" is entered?
>>
>> Do our coding guidelines allow for this? (I've been burned by this
>> before, on a buggy C++ runtime that didn't manage to support these).
>> I'm a little nervous about this, touching global state before
>> "main" (e.g. from the point-of-view of the JIT), though I don't know
>yet
>> if this is just a gut reaction, or if there's a valid concern here
>(I'm
>> officially on holiday this week, so I haven't had a chance to dig
>deeply
>> into these patches yet, sorry).
>That idiom is used in various places by Martin's patches. I didn't
>see
>a strong rhyme or reason behind why it was used over allocating
>something in automatic or heap storage.
>
>As to supporting it, I'm not terribly concerned about other buggy C++
>runtimes. GCC bootstraps with GCC, which means we've got our C++
>runtime. The only worry becomes the low level bits that we build our
>static ctor/dtor support on top of -- and I haven't seen major problems
>
>with that for eons.
But we've been trying to avoid this. And the jit might not be too happy about it either.
>jeff