aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-06-13 11:21:30 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-06-13 11:21:30 +0200
commit10827cd8b31a8ced2cf6fbd6e4b902628c9a4ceb (patch)
treedb3fc5592b68d1ca71570ab74208c662419bc2e0 /gcc/cp/name-lookup.c
parentcd8d4e24e0b04c77dd709aeea7075d0a6a0f2833 (diff)
downloadgcc-10827cd8b31a8ced2cf6fbd6e4b902628c9a4ceb.zip
gcc-10827cd8b31a8ced2cf6fbd6e4b902628c9a4ceb.tar.gz
gcc-10827cd8b31a8ced2cf6fbd6e4b902628c9a4ceb.tar.bz2
re PR middle-end/27793 (num_ssa_names inconsistent or immediate use iterator wrong)
PR middle-end/27793 * cp-tree.h (cxx_int_tree_map): New struct. (struct language_function): Add extern_decl_map field. * name-lookup.c (pushdecl_maybe_friend): Add x -> t mapping to cp_function_chain->extern_decl_map hash table instead of copying over DECL_UID. * cp-gimplify.c (cxx_int_tree_map_eq, cxx_int_tree_map_hash): New functions. (cp_genericize_r): Remap DECL_EXTERN local decls using cp_function_chain->extern_decl_map hash table. * decl.c (finish_function): Clear extern_decl_map. PR c++/26757 PR c++/27894 * g++.dg/tree-ssa/pr26757.C: New test. * g++.dg/tree-ssa/pr27894.C: New test. From-SVN: r114607
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 187a41f..3de9999 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -670,14 +670,28 @@ pushdecl_maybe_friend (tree x, bool is_friend)
if (decls_match (x, t))
/* The standard only says that the local extern
inherits linkage from the previous decl; in
- particular, default args are not shared. We must
- also tell cgraph to treat these decls as the same,
- or we may neglect to emit an "unused" static - we
- do this by making the DECL_UIDs equal, which should
- be viewed as a kludge. FIXME. */
+ particular, default args are not shared. Add
+ the decl into a hash table to make sure only
+ the previous decl in this case is seen by the
+ middle end. */
{
+ struct cxx_int_tree_map *h;
+ void **loc;
+
TREE_PUBLIC (x) = TREE_PUBLIC (t);
- DECL_UID (x) = DECL_UID (t);
+
+ if (cp_function_chain->extern_decl_map == NULL)
+ cp_function_chain->extern_decl_map
+ = htab_create_ggc (20, cxx_int_tree_map_hash,
+ cxx_int_tree_map_eq, NULL);
+
+ h = GGC_NEW (struct cxx_int_tree_map);
+ h->uid = DECL_UID (x);
+ h->to = t;
+ loc = htab_find_slot_with_hash
+ (cp_function_chain->extern_decl_map, h,
+ h->uid, INSERT);
+ *(struct cxx_int_tree_map **) loc = h;
}
}
else if (TREE_CODE (t) == PARM_DECL)