386: Disallow naked attribute with interrupt attribute
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 1 Aug 2017 20:25:41 +0000 (20:25 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 1 Aug 2017 20:25:41 +0000 (13:25 -0700)
gcc/

PR target/81654
* config/i386/i386.c (ix86_set_func_type): Disallow naked
attribute with interrupt attribute.

gcc/testsuite/

PR target/81654
* gcc.target/i386/pr81654.c: New test.

From-SVN: r250793

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr81654.c [new file with mode: 0644]

index 43b2311973d0190ae0d32f466cc43d234e3954e9..64298bc6d799ed7f2f96c9fb5676a1f7232fb4a8 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/81654
+       * config/i386/i386.c (ix86_set_func_type): Disallow naked
+       attribute with interrupt attribute.
+
 2017-08-01  Andrew Pinski  <apinski@cavium.com>
 
        * tree-ssa-scopedtables.c (hashable_expr_equal_p): Check
index 494a18a2cd17c8c1f881dba552f3bcd04f3f5b31..587dbe61e8b34184bb90113edaa99b52e615b246 100644 (file)
@@ -7523,6 +7523,10 @@ ix86_set_func_type (tree fndecl)
       if (lookup_attribute ("interrupt",
                            TYPE_ATTRIBUTES (TREE_TYPE (fndecl))))
        {
+         if (ix86_function_naked (fndecl))
+           error_at (DECL_SOURCE_LOCATION (fndecl),
+                     "interrupt and naked attributes are not compatible");
+
          int nargs = 0;
          for (tree arg = DECL_ARGUMENTS (fndecl);
               arg;
index 3ba6bb980706a3f53a3bdce463f699033f4fd0b2..7a0a03004cc27a56b68a93c2d85701b5e2ad6a29 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/81654
+       * gcc.target/i386/pr81654.c: New test.
+
 2017-08-01  Thomas König  <tkoenig@gcc.gnu.org>
 
        PR fortran/79312
diff --git a/gcc/testsuite/gcc.target/i386/pr81654.c b/gcc/testsuite/gcc.target/i386/pr81654.c
new file mode 100644 (file)
index 0000000..2a1a4b7
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mgeneral-regs-only" } */
+
+__attribute__((interrupt, naked))
+void
+fn (void *frame) /* { dg-error "not compatible" } */
+{
+}