https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86560

--- Comment #3 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Thu Jul 19 10:47:23 2018
New Revision: 262877

URL: https://gcc.gnu.org/viewcvs?rev=262877&root=gcc&view=rev
Log:
i386: Change indirect_return to function type attribute

In

struct ucontext;
typedef struct ucontext ucontext_t;

extern int (*bar) (ucontext_t *__restrict __oucp,
                   const ucontext_t *__restrict __ucp)
  __attribute__((__indirect_return__));

extern int res;

void
foo (ucontext_t *oucp, ucontext_t *ucp)
{
  res = bar (oucp, ucp);
}

bar() may return via indirect branch.  This patch changes indirect_return
to type attribute to allow indirect_return attribute on variable or type
of function pointer so that ENDBR can be inserted after call to bar().

gcc/

        PR target/86560
        * config/i386/i386.c (rest_of_insert_endbranch): Lookup
        indirect_return as function type attribute.
        (ix86_attribute_table): Change indirect_return to function
        type attribute.
        * doc/extend.texi: Update indirect_return attribute.

gcc/testsuite/

        PR target/86560
        * gcc.target/i386/pr86560-1.c: New test.
        * gcc.target/i386/pr86560-2.c: Likewise.
        * gcc.target/i386/pr86560-3.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr86560-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr86560-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr86560-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/ChangeLog

Reply via email to