This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/24172] [4.1 Regression] error: incorrect sharing of tree nodes
- From: "hubicka at ucw dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Oct 2005 12:56:12 -0000
- Subject: [Bug tree-optimization/24172] [4.1 Regression] error: incorrect sharing of tree nodes
- References: <bug-24172-11423@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from hubicka at ucw dot cz 2005-10-04 12:56 -------
Subject: Re: [4.1 Regression] error: incorrect sharing of tree nodes
>
>
> ------- Comment #5 from rguenth at gcc dot gnu dot org 2005-10-04 10:44 -------
> The problem is, that with this part of the blamed patch
>
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
> retrieving revision 1.182
> retrieving revision 1.183
> diff -u -r1.182 -r1.183
> --- gcc/gcc/tree-inline.c 2005/04/23 21:27:58 1.182
> +++ gcc/gcc/tree-inline.c 2005/05/13 13:56:54 1.183
> @@ -566,21 +566,15 @@
> {
> /* Get rid of *& from inline substitutions that can happen when a
> pointer argument is an ADDR_EXPR. */
> - tree decl = TREE_OPERAND (*tp, 0), value;
> + tree decl = TREE_OPERAND (*tp, 0);
> splay_tree_node n;
>
> n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl);
> if (n)
> {
> - value = (tree) n->value;
> - STRIP_NOPS (value);
> - if (TREE_CODE (value) == ADDR_EXPR
> - && (lang_hooks.types_compatible_p
> - (TREE_TYPE (*tp), TREE_TYPE (TREE_OPERAND (value, 0)))))
> - {
> - *tp = TREE_OPERAND (value, 0);
> - return copy_body_r (tp, walk_subtrees, data);
> - }
> + *tp = build_fold_indirect_ref ((tree)n->value);
> + *walk_subtrees = 0;
> + return NULL;
> }
> }
>
> we do not have *tp unshared anymore. Is build_fold_indirect_ref supposed
> to do that?
It is not, but the entries of decl_map are expected to be shareable.
There are couple of other places where n->value is substituted in
without further copying. I see there can be NOP_EXPRs and ADDR_EXPRs
that are supposed to be unshared.
We don't want to recurse on substituted value as we would mess up
recursive functions and friends, but probably somehing like unshare_expr
call on all places we dosubstitution would work?
I can look into that tomorrow unless someone beats me ;)
Honza
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24172