This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer
- From: "aoliva at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2005 19:29:24 -0000
- Subject: [Bug c++/20103] [4.0/4.1 regression] ICE in create_tmp_var with C99 style struct initializer
- References: <20050220111234.20103.falk@debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From aoliva at gcc dot gnu dot org 2005-03-11 19:29 -------
Subject: Re: [PR c++/20103] failure to gimplify constructors for addressable types
On Mar 11, 2005, Richard Henderson <rth@gcc.gnu.org> wrote:
> On Tue, Mar 08, 2005 at 05:42:57PM -0300, Alexandre Oliva wrote:
>> The change to the gimplify.c is needed to avoid having
>> gimple_add_tmp_var twice for the variable, once while expanding the
>> declaration/initialization, once while expanding the clean-ups.
> Can you say more about how this comes to be? It doesn't make
> sense to me...
Just a matter of misinterpreting observed behavior :-(
Here's the correct sequence of events without the change:
gimplify_compound_literal_expr calls gimple_add_tmp_var, and then
gimplify_and_add for the statement list containing the decl of the
temporary variable
gimplify_and_add calls gimplify_stmt for the stmt list, that calls
calls gimplify_expr, that calls gimplify_decl_expr, that calls
gimple_add_tmp_var again.
I should now try to figure out why it is that in C it doesn't get
called twice, in but in C++ it does.
I remember I tried to remove the first call from
gimplify_compound_literal_expr, but that didn't work because the
presence of the initializer would cause gimplify_decl_expr to build a
modify_expr referencing the decl, and this fails if the decl isn't,
erhm, bound yet. Perhaps I should move the call to gimple_add_tmp_var
in gimplify_decl_expr before the init stmt; this even makes sense to
me.
Incidentally, we don't actually generate cleanups for these temps,
unlike the target_expr case, so we fail to call dtors for them. Ugh.
Fixing this will take some more work. Patch withdrawn for the time
being.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20103