------- Comment #13 from hubicka at gcc dot gnu dot org 2005-10-27 21:18 ------- This is patch I am testing to prevent the sharing. I think it is good idea in addition to Richard's patch to make fold do it's job too:
void IOException( char); inline int* dummy( const char* const mode ) { IOException(*mode+*mode); } void prepare_inpaint( ) { dummy ("rb"); } Index: tree-inline.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v retrieving revision 1.212 diff -c -3 -p -r1.212 tree-inline.c *** tree-inline.c 12 Oct 2005 23:34:09 -0000 1.212 --- tree-inline.c 27 Oct 2005 21:16:34 -0000 *************** copy_body_r (tree *tp, int *walk_subtree *** 639,644 **** --- 639,645 ---- n = splay_tree_lookup (id->decl_map, (splay_tree_key) decl); if (n) { + tree new; /* If we happen to get an ADDR_EXPR in n->value, strip it manually here as we'll eventually get ADDR_EXPRs which lie about their types pointed to. In this case *************** copy_body_r (tree *tp, int *walk_subtree *** 646,658 **** but we absolutely rely on that. As fold_indirect_ref does other useful transformations, try that first, though. */ tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); ! *tp = fold_indirect_ref_1 (type, (tree)n->value); if (! *tp) { ! if (TREE_CODE ((tree)n->value) == ADDR_EXPR) ! *tp = TREE_OPERAND ((tree)n->value, 0); else ! *tp = build1 (INDIRECT_REF, type, (tree)n->value); } *walk_subtrees = 0; return NULL; --- 647,660 ---- but we absolutely rely on that. As fold_indirect_ref does other useful transformations, try that first, though. */ tree type = TREE_TYPE (TREE_TYPE ((tree)n->value)); ! new = unshare_expr ((tree)n->value); ! *tp = fold_indirect_ref_1 (type, new); if (! *tp) { ! if (TREE_CODE (new) == ADDR_EXPR) ! *tp = TREE_OPERAND (new, 0); else ! *tp = build1 (INDIRECT_REF, type, new); } *walk_subtrees = 0; return NULL; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24172