This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SH interrupt handler sibcall patch

This patch stops Hitachi SH interrupt handlers erroneously tail calling other 
procedures, which almost certainly don't have the right stack pop/rte ending 

some text for the changelog:  Stop interrupt handlers from tail calling

? shsibcall.patch
Index: sh.h
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.142
diff -u -r1.142 sh.h
--- sh.h	15 May 2002 05:29:59 -0000	1.142
+++ sh.h	17 May 2002 02:26:57 -0000
@@ -1608,8 +1608,18 @@
    receives arguments ``by reference'' will have them stored in its
    own stack frame, so it must not pass pointers or references to
    these arguments to other functions by means of sibling calls.  */
-  (! TARGET_SHCOMPACT || current_function_args_info.stack_regs == 0)
+/* Stop interrupt routines from being candidates for tail calls (as the 
+   caller) since the callee won't be restoring all the registers required by 
+   an interrupt handler */
+  ((lookup_attribute                                 \
+    ("interrupt_handler",                      \
+             DECL_ATTRIBUTES (current_function_decl))\
+              == NULL_TREE)                             \
+  && \
+  ( ! TARGET_SHCOMPACT || current_function_args_info.stack_regs == 0))
 /* Update the data in CUM to advance over an argument
    of mode MODE and data type TYPE.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]