aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-03-03 14:01:46 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-03-03 14:01:46 -0500
commitd6dcdbd5f673e4005a11419d83c0b99af6a512bb (patch)
treedcb54ad852b4d32d85d9ad046265f49b6f8283d7 /gcc
parent58a15cf8ee953516f101e4320e83c3fed6bb2cd7 (diff)
downloadgcc-d6dcdbd5f673e4005a11419d83c0b99af6a512bb.zip
gcc-d6dcdbd5f673e4005a11419d83c0b99af6a512bb.tar.gz
gcc-d6dcdbd5f673e4005a11419d83c0b99af6a512bb.tar.bz2
re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909 * method.c (make_alias_for): Handle VAR_DECL, too. * decl2.c (vague_linkage_p): Rename from vague_linkage_fn_p. * tree.c (no_linkage_check): Adjust. * decl.c (maybe_commonize_var): Adjust. * mangle.c (mangle_decl): Adjust. * cp-tree.h: Adjust. From-SVN: r157202
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/decl2.c17
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/method.c34
-rw-r--r--gcc/cp/tree.c2
7 files changed, 37 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b0b72b..926bb7b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -6,6 +6,11 @@
ABI version, make the later mangled name an alias.
* method.c (make_alias_for): Copy DECL_ARGUMENTS.
* Make-lang.in (mangle.o): Depend on cgraph.h.
+ * method.c (make_alias_for): Handle VAR_DECL, too.
+ * decl2.c (vague_linkage_p): Rename from vague_linkage_fn_p.
+ * tree.c (no_linkage_check): Adjust.
+ * decl.c (maybe_commonize_var): Adjust.
+ * cp-tree.h: Adjust.
2010-03-01 Marco Poletti <poletti.marco@gmail.com>
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4e1815f..5604a9d 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4735,7 +4735,7 @@ extern tree build_memfn_type (tree, tree, cp_cv_quals);
extern tree change_return_type (tree, tree);
extern void maybe_retrofit_in_chrg (tree);
extern void maybe_make_one_only (tree);
-extern bool vague_linkage_fn_p (tree);
+extern bool vague_linkage_p (tree);
extern void grokclassfn (tree, tree,
enum overload_flags);
extern tree grok_array_decl (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 3eec0c7..67377b0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4642,7 +4642,7 @@ maybe_commonize_var (tree decl)
/* Don't mess with __FUNCTION__. */
&& ! DECL_ARTIFICIAL (decl)
&& DECL_FUNCTION_SCOPE_P (decl)
- && vague_linkage_fn_p (DECL_CONTEXT (decl)))
+ && vague_linkage_p (DECL_CONTEXT (decl)))
{
if (flag_weak)
{
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c5b6e87..81d7ee3 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1642,20 +1642,21 @@ maybe_make_one_only (tree decl)
}
}
-/* Returns true iff DECL, a FUNCTION_DECL, has vague linkage. This
- predicate will give the right answer during parsing of the function,
- which other tests may not. */
+/* Returns true iff DECL, a FUNCTION_DECL or VAR_DECL, has vague linkage.
+ This predicate will give the right answer during parsing of the
+ function, which other tests may not. */
bool
-vague_linkage_fn_p (tree fn)
+vague_linkage_p (tree decl)
{
/* Unfortunately, import_export_decl has not always been called
before the function is processed, so we cannot simply check
DECL_COMDAT. */
- return (DECL_COMDAT (fn)
- || ((DECL_DECLARED_INLINE_P (fn)
- || DECL_TEMPLATE_INSTANTIATION (fn))
- && TREE_PUBLIC (fn)));
+ return (DECL_COMDAT (decl)
+ || (((TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (decl))
+ || DECL_TEMPLATE_INSTANTIATION (decl))
+ && TREE_PUBLIC (decl)));
}
/* Determine whether or not we want to specifically import or export CTYPE,
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 9478092..02b8a82 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3083,7 +3083,7 @@ mangle_decl (const tree decl)
DECL_IGNORED_P (alias) = 1;
TREE_PUBLIC (alias) = TREE_PUBLIC (decl);
DECL_VISIBILITY (alias) = DECL_VISIBILITY (decl);
- if (vague_linkage_fn_p (decl))
+ if (vague_linkage_p (decl))
DECL_WEAK (alias) = 1;
cgraph_same_body_alias (alias, decl);
}
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index c25cedb..a93ad06 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -207,34 +207,38 @@ finish_thunk (tree thunk)
static GTY (()) int thunk_labelno;
-/* Create a static alias to function. */
+/* Create a static alias to target. */
tree
-make_alias_for (tree function, tree newid)
+make_alias_for (tree target, tree newid)
{
- tree alias = build_decl (DECL_SOURCE_LOCATION (function),
- FUNCTION_DECL, newid, TREE_TYPE (function));
- DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
+ tree alias = build_decl (DECL_SOURCE_LOCATION (target),
+ TREE_CODE (target), newid, TREE_TYPE (target));
+ DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (target);
cxx_dup_lang_specific_decl (alias);
DECL_CONTEXT (alias) = NULL;
- TREE_READONLY (alias) = TREE_READONLY (function);
- TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function);
+ TREE_READONLY (alias) = TREE_READONLY (target);
+ TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
TREE_PUBLIC (alias) = 0;
DECL_INTERFACE_KNOWN (alias) = 1;
DECL_NOT_REALLY_EXTERN (alias) = 1;
- DECL_THIS_STATIC (alias) = 1;
- DECL_SAVED_FUNCTION_DATA (alias) = NULL;
- DECL_DESTRUCTOR_P (alias) = 0;
- DECL_CONSTRUCTOR_P (alias) = 0;
DECL_EXTERNAL (alias) = 0;
DECL_ARTIFICIAL (alias) = 1;
- DECL_PENDING_INLINE_P (alias) = 0;
- DECL_DECLARED_INLINE_P (alias) = 0;
DECL_USE_TEMPLATE (alias) = 0;
DECL_TEMPLATE_INSTANTIATED (alias) = 0;
DECL_TEMPLATE_INFO (alias) = NULL;
- DECL_INITIAL (alias) = error_mark_node;
- DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
+ if (TREE_CODE (alias) == FUNCTION_DECL)
+ {
+ DECL_SAVED_FUNCTION_DATA (alias) = NULL;
+ DECL_DESTRUCTOR_P (alias) = 0;
+ DECL_CONSTRUCTOR_P (alias) = 0;
+ DECL_PENDING_INLINE_P (alias) = 0;
+ DECL_DECLARED_INLINE_P (alias) = 0;
+ DECL_INITIAL (alias) = error_mark_node;
+ DECL_ARGUMENTS (alias) = copy_list (DECL_ARGUMENTS (target));
+ }
+ else
+ TREE_STATIC (alias) = 1;
TREE_ADDRESSABLE (alias) = 1;
TREE_USED (alias) = 1;
SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 31b54f6..9867d2e 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1607,7 +1607,7 @@ no_linkage_check (tree t, bool relaxed_p)
return no_linkage_check (TYPE_CONTEXT (t), relaxed_p);
else if (TREE_CODE (r) == FUNCTION_DECL)
{
- if (!relaxed_p || !vague_linkage_fn_p (r))
+ if (!relaxed_p || !vague_linkage_p (r))
return t;
else
r = CP_DECL_CONTEXT (r);