------- Additional Comments From mark at codesourcery dot com 2005-03-06 18:02
-------
Subject: Re: [PR c++/20103] failure to gimplify constructors for addressable
types
Alexandre Oliva wrote:
> + case TARGET_EXPR:
> + {
> + tree r = tsubst_copy (t, args, complain, in_decl);
> +
> + TREE_TYPE (r) = RECUR (TREE_TYPE (t));
> + TARGET_EXPR_SLOT (r) = RECUR (TARGET_EXPR_SLOT (t));
> + TARGET_EXPR_INITIAL (r) = RECUR (TARGET_EXPR_INITIAL (t));
> + TARGET_EXPR_CLEANUP (r) = RECUR (TARGET_EXPR_CLEANUP (t));
> +
> + if (TREE_TYPE (TARGET_EXPR_SLOT (t))
> + == TREE_TYPE (TARGET_EXPR_INITIAL (t)))
> + TREE_TYPE (TARGET_EXPR_SLOT (r)) =
> + TREE_TYPE (TARGET_EXPR_INITIAL (r));
> +
> + if (TREE_TYPE (t) == TREE_TYPE (TARGET_EXPR_SLOT (t)))
> + TREE_TYPE (r) = TREE_TYPE (TARGET_EXPR_SLOT (r));
> +
> + return r;
This doesn't look quite right. First, we're trying to get rid of
tsubst_copy; we should not add new calls. You should do the RECURs
here, and then build up the new node. And, the manipulations of
TREE_TYPE don't make sense: (a) using "==" to compare types is almost
always wrong, and (b) the RECURs should already maintain the invariant
you're trying to maintain.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20103