From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22806 invoked by alias); 23 Apr 2008 13:30:13 -0000 Received: (qmail 22490 invoked by uid 48); 23 Apr 2008 13:29:24 -0000 Date: Wed, 23 Apr 2008 13:30:00 -0000 Message-ID: <20080423132924.22489.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/36015] [4.3/4.4 Regression] -mregparm and fn decls without arguments In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg01635.txt.bz2 ------- Comment #4 from jakub at gcc dot gnu dot org 2008-04-23 13:29 ------- I've instead regtested: --- gcc/config/i386/i386.c.jj 2008-04-01 13:34:27.000000000 +0200 +++ gcc/config/i386/i386.c 2008-04-23 13:38:14.000000000 +0200 @@ -3501,7 +3501,7 @@ init_cumulative_args (CUMULATIVE_ARGS *c { /* If there are variable arguments, then we won't pass anything in registers in 32-bit mode. */ - if (cum->maybe_vaarg) + if (stdarg_p (fntype)) { cum->nregs = 0; cum->sse_nregs = 0; patch (on i686 only, as this is !TARGET_64BIT hunk of code). IMHO it best matches what 4.2 and earlier did. Here is the 4.2 code: cum->maybe_vaarg = false; ... /* Determine if this function has variable arguments. This is indicated by the last argument being 'void_type_mode' if there are no variable arguments. If there are variable arguments, then we won't pass anything in registers in 32-bit mode. */ if (cum->nregs || cum->mmx_nregs || cum->sse_nregs) { for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0; param != 0; param = next_param) { next_param = TREE_CHAIN (param); if (next_param == 0 && TREE_VALUE (param) != void_type_node) { if (!TARGET_64BIT) { cum->nregs = 0; cum->sse_nregs = 0; cum->mmx_nregs = 0; cum->warn_sse = 0; cum->warn_mmx = 0; cum->fastcall = 0; cum->float_in_sse = 0; } cum->maybe_vaarg = true; } } } if ((!fntype && !libname) || (fntype && !TYPE_ARG_TYPES (fntype))) cum->maybe_vaarg = true; The param/next_param testing IMHO is stdarg_p test, so cum->nregs etc. are cleared only if !TARGET_64BIT && stdarg_p (fntype). maybe_vaarg is set if stdarg_p (fntype), or for fntype && !prototype_p (fntype), or for !fntype && !libname. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36015