+2018-03-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/84723
+ * multiple_target.c: Include tree-inline.h and intl.h.
+ (expand_target_clones): Diagnose and fail if node->definition and
+ !tree_versionable_function_p (node->decl).
+
2018-03-06 John David Anglin <danglin@gcc.gnu.org>
* config/pa/pa.h (ASM_GENERATE_INTERNAL_LABEL): Revise to use
#include "pretty-print.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
+#include "tree-inline.h"
+#include "intl.h"
/* Walker callback that replaces all FUNCTION_DECL of a function that's
going to be versioned. */
return false;
}
+ if (node->definition
+ && !tree_versionable_function_p (node->decl))
+ {
+ error_at (DECL_SOURCE_LOCATION (node->decl),
+ "clones for %<target_clones%> attribute cannot be created");
+ const char *reason = NULL;
+ if (lookup_attribute ("noclone", DECL_ATTRIBUTES (node->decl)))
+ reason = G_("function %q+F can never be copied "
+ "because it has %<noclone%> attribute");
+ else
+ reason = copy_forbidden (DECL_STRUCT_FUNCTION (node->decl));
+ if (reason)
+ inform (DECL_SOURCE_LOCATION (node->decl), reason, node->decl);
+ return false;
+ }
+
char *attr_str = XNEWVEC (char, attr_len);
int attrnum = get_attr_str (arglist, attr_str);
char **attrs = XNEWVEC (char *, attrnum);
+2018-03-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/84723
+ * gcc.target/i386/pr84723-1.c: New test.
+ * gcc.target/i386/pr84723-2.c: New test.
+ * gcc.target/i386/pr84723-3.c: New test.
+ * gcc.target/i386/pr84723-4.c: New test.
+ * gcc.target/i386/pr84723-5.c: New test.
+
2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/64107
--- /dev/null
+/* PR middle-end/84723 */
+/* { dg-do compile } */
+/* { dg-require-ifunc } */
+/* { dg-options "-O2" } */
+
+__attribute__((target_clones ("avx", "default")))
+__attribute__((noclone))
+void
+foo (void) /* { dg-error "clones for .target_clones. attribute cannot be created" } */
+{ /* { dg-message "function .foo. can never be copied because it has .noclone. attribute" "" { target *-*-* } .-1 } */
+}
--- /dev/null
+/* PR middle-end/84723 */
+/* { dg-do compile } */
+/* { dg-require-ifunc } */
+/* { dg-options "-O2" } */
+
+__attribute__((target_clones ("avx", "default")))
+void
+foo (void) /* { dg-error "clones for .target_clones. attribute cannot be created" } */
+{ /* { dg-message "function .foo. can never be copied because it saves address of local label in a static variable" "" { target *-*-* } .-1 } */
+ static void *p = &&lab;
+ asm volatile ("" : "+m" (p) : : "memory");
+lab:;
+}
--- /dev/null
+/* PR middle-end/84723 */
+/* { dg-do compile } */
+/* { dg-require-ifunc } */
+/* { dg-options "-O2" } */
+
+__attribute__((target_clones ("avx", "default")))
+int
+foo (int x) /* { dg-error "clones for .target_clones. attribute cannot be created" } */
+{ /* { dg-message "function .foo. can never be copied because it receives a non-local goto" "" { target *-*-* } .-1 } */
+ __label__ lab;
+ __attribute__((noinline)) void bar () { goto lab; }
+ if (x == 5)
+ bar ();
+ x++;
+lab:;
+ return x;
+}
--- /dev/null
+/* PR middle-end/84723 */
+/* { dg-do compile } */
+/* { dg-require-ifunc } */
+/* { dg-options "-O2" } */
+
+__attribute__((target_clones ("avx", "default")))
+__attribute__((naked))
+void
+foo (void) /* { dg-error "clones for .target_clones. attribute cannot be created" } */
+{ /* { dg-message "function .foo. can never be copied because it has .noclone. attribute" "" { target *-*-* } .-1 } */
+}
--- /dev/null
+/* PR middle-end/84723 */
+/* { dg-do compile } */
+/* { dg-require-ifunc } */
+/* { dg-options "-O2" } */
+
+__attribute__((target_clones ("avx", "default")))
+__attribute__((noipa))
+void
+foo (void) /* { dg-error "clones for .target_clones. attribute cannot be created" } */
+{ /* { dg-message "function .foo. can never be copied because it has .noclone. attribute" "" { target *-*-* } .-1 } */
+}