+2018-02-07 Martin Liska <mliska@suse.cz>
+
+ PR c++/84059.
+ * class.c (add_method): Append argument value.
+ * cp-tree.h (maybe_version_functions): Add new argument.
+ * decl.c (decls_match): Call it if a declaration does not
+ have DECL_FUNCTION_VERSIONED.
+ (maybe_version_functions): record argument is added.
+
2018-02-05 Marek Polacek <polacek@redhat.com>
* class.c: Remove unused global variables.
/* If these are versions of the same function, process and
move on. */
if (TREE_CODE (fn) == FUNCTION_DECL
- && maybe_version_functions (method, fn))
+ && maybe_version_functions (method, fn, true))
continue;
if (DECL_INHERITED_CTOR (method))
extern void note_iteration_stmt_body_end (bool);
extern tree make_lambda_name (void);
extern int decls_match (tree, tree, bool = true);
-extern bool maybe_version_functions (tree, tree);
+extern bool maybe_version_functions (tree, tree, bool);
extern tree duplicate_decls (tree, tree, bool);
extern tree declare_local_label (tree);
extern tree define_label (location_t, tree);
&& !DECL_EXTERN_C_P (newdecl)
&& !DECL_EXTERN_C_P (olddecl)
&& record_versions
- && maybe_version_functions (newdecl, olddecl))
+ && maybe_version_functions (newdecl, olddecl,
+ (!DECL_FUNCTION_VERSIONED (newdecl)
+ || !DECL_FUNCTION_VERSIONED (olddecl))))
return 0;
}
else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
}
/* NEWDECL and OLDDECL have identical signatures. If they are
- different versions adjust them and return true. */
+ different versions adjust them and return true.
+ If RECORD is set to true, record function versions. */
bool
-maybe_version_functions (tree newdecl, tree olddecl)
+maybe_version_functions (tree newdecl, tree olddecl, bool record)
{
if (!targetm.target_option.function_versions (newdecl, olddecl))
return false;
- bool record = false;
-
if (!DECL_FUNCTION_VERSIONED (olddecl))
{
- record = true;
DECL_FUNCTION_VERSIONED (olddecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (olddecl))
mangle_decl (olddecl);
if (!DECL_FUNCTION_VERSIONED (newdecl))
{
- record = true;
DECL_FUNCTION_VERSIONED (newdecl) = 1;
if (DECL_ASSEMBLER_NAME_SET_P (newdecl))
mangle_decl (newdecl);
}
- /* Only record if at least one was not already versions. */
if (record)
cgraph_node::record_function_versions (olddecl, newdecl);
+2018-02-07 Martin Liska <mliska@suse.cz>
+
+ PR c++/84059.
+ * g++.dg/ext/mv26.C: New test.
+
2018-02-07 Tom de Vries <tom@codesourcery.com>
* gcc.dg/pr83844.c: Require effective target alloca.
--- /dev/null
+// PR c++/84059
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-require-ifunc "" }
+
+template <typename> struct a
+{
+ int __attribute__ ((target ("arch=ivybridge"))) c (int) {return 1;}
+ int __attribute__ ((target ("default"))) c (int) { return 2; }
+};
+void
+d ()
+{
+ a<double> b;
+ b.c (2);
+}