From ad68cabeadaaa27dcdfb695abfc418e8380944eb Mon Sep 17 00:00:00 2001 From: hjl Date: Tue, 1 Aug 2017 20:25:41 +0000 Subject: [PATCH] 386: Disallow naked attribute with interrupt attribute 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250793 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr81654.c | 8 ++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr81654.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43b2311973d..64298bc6d79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-08-01 H.J. Lu + + PR target/81654 + * config/i386/i386.c (ix86_set_func_type): Disallow naked + attribute with interrupt attribute. + 2017-08-01 Andrew Pinski * tree-ssa-scopedtables.c (hashable_expr_equal_p): Check diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 494a18a2cd1..587dbe61e8b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ba6bb98070..7a0a03004cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-01 H.J. Lu + + PR target/81654 + * gcc.target/i386/pr81654.c: New test. + 2017-08-01 Thomas König 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 index 00000000000..2a1a4b72f1e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81654.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mgeneral-regs-only" } */ + +__attribute__((interrupt, naked)) +void +fn (void *frame) /* { dg-error "not compatible" } */ +{ +} -- 2.11.4.GIT