This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix PR23828
- From: Dan Nicolaescu <dann at ics dot uci dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 21 Sep 2005 10:43:42 -0700
- Subject: [patch] Fix PR23828
PR23828 happens because the test for nested functions is incorrect in
ix86_function_regparm.
When using -fwhole-program --combine
DECL_CONTEXT (decl) is a TRANSLATION_UNIT_DECL for a static function
that is not nested, i.e. non-NULL...
This patch uses decl_function_context (decl) to test if the function
is nested.
Tested with no regressions on i686-pc-linux-gnu.
OK?
2005-09-21 Dan Nicolaescu <dann@ics.uci.edu>
PR23828
* config/i386/i386.c (ix86_function_regparm): Fix the test for
a nested function.
--- i386.c~ 2005-09-11 12:49:10.000000000 -0700
+++ i386.c 2005-09-20 16:37:38.000000000 -0700
@@ -2158,7 +2158,8 @@ ix86_function_regparm (tree type, tree d
/* We can't use regparm(3) for nested functions as these use
static chain pointer in third argument. */
if (local_regparm == 3
- && DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
+ && decl_function_context (decl)
+ && !DECL_NO_STATIC_CHAIN (decl))
local_regparm = 2;
/* Each global register variable increases register preassure,
so the more global reg vars there are, the smaller regparm