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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
GCC correctly identified that foo1 == foo2 and generate a tail call.
But we don't want tail call in interrupt handler.  On the other hand,
there is no need to have 2 identical copies of an interrupt handler.
There should be only one interrupt handler or they should be different.

This patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index eef6d7b..be40ad9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -28014,7 +28014,8 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
       if (fndecl
     && (lookup_attribute ("interrupt",
            TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))))
-  error ("interrupt service routine can't be called directly");
+  error ("interrupt service routine %q+D can't be called directly",
+         fndecl);
     }
   else
     fndecl = NULL_TREE;

changes the error message to

foo.i: In function ‘foo1’:
foo.i:9:33: error: interrupt service routine ‘foo2’ can't be called directly
 __attribute__((interrupt)) void foo2 (void *p)

to indicate that foo2 is called from foo1.

Reply via email to