This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] 386: Disallow naked attribute with interrupt attribute
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 1 Aug 2017 22:23:19 +0200
- Subject: Re: [PATCH] 386: Disallow naked attribute with interrupt attribute
- Authentication-results: sourceware.org; auth=none
- References: <20170801202055.GA6800@gmail.com>
On Tue, Aug 1, 2017 at 10:20 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> OK for trunk?
>
> H.J.
> ---
> 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.
OK.
Thanks,
Uros.
> gcc/config/i386/i386.c | 4 ++++
> gcc/testsuite/gcc.target/i386/pr81654.c | 8 ++++++++
> 2 files changed, 12 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/pr81654.c
>
> 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/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.13.3
>