This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Potential fix for PR24374


2005-10-15 Kean Johnston <jkj@sco.com>

	PR/24374
	* calls.c (expand_call): Dont do sibcall optimization on main.

Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.402
diff -u -3 -p -r1.402 calls.c
--- calls.c	8 Oct 2005 03:33:46 -0000	1.402
+++ calls.c	15 Oct 2005 20:12:25 -0000
@@ -2148,7 +2148,10 @@ expand_call (tree exp, rtx target, int i
   if (currently_expanding_call++ != 0
       || !flag_optimize_sibling_calls
       || args_size.var
-      || lookup_stmt_eh_region (exp) >= 0)
+      || lookup_stmt_eh_region (exp) >= 0
+      || (current_function_decl && (DECL_NAME (current_function_decl)
+	  && MAIN_NAME_P (DECL_NAME (current_function_decl))
+	  && DECL_FILE_SCOPE_P (current_function_decl))))
     try_tail_call = 0;

/* Rest of purposes for tail call optimizations to fail. */


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