Reject target("no-general-regs-only") pragma and attribute.
gcc/
PR target/96802
* config/i386/i386-options.c (ix86_valid_target_attribute_inner_p):
Reject target("no-general-regs-only").
gcc/testsuite/
PR target/96802
* gcc.target/i386/pr96802-1.c: New test.
* gcc.target/i386/pr96802-2.c: Likewise.
{
if (mask == OPTION_MASK_GENERAL_REGS_ONLY)
{
+ if (!opt_set_p)
+ {
+ error_at (loc, "pragma or attribute %<target(\"%s\")%> "
+ "does not allow a negated form", p);
+ return false;
+ }
+
if (type != ix86_opt_ix86_yes)
gcc_unreachable ();
--- /dev/null
+/* { dg-do compile } */
+
+/* Reject the negated form of non-negatable attributes. */
+
+__attribute__ ((target ("no-general-regs-only")))
+int
+foo (int a)
+{
+ return a + 1;
+}
+
+/* { dg-error "does not allow a negated form" "" { target *-*-* } 0 } */
--- /dev/null
+/* { dg-do compile } */
+
+/* Reject the negated form of non-negatable pragma target. */
+
+#pragma GCC push_options
+#pragma GCC target("no-general-regs-only")
+
+int
+foo (int a)
+{
+ return a + 1;
+}
+
+#pragma GCC pop_options
+
+/* { dg-error "does not allow a negated form" "" { target *-*-* } 0 } */