This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Potential fix for PR24374
- From: Kean Johnston <jkj at sco dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 15 Oct 2005 13:15:39 -0700
- Subject: Potential fix for PR24374
- Reply-to: jkj at sco dot com
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. */