From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31311 invoked by alias); 27 Oct 2011 10:34:53 -0000 Received: (qmail 31183 invoked by uid 22791); 27 Oct 2011 10:34:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 10:34:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id E87FECB0214; Thu, 27 Oct 2011 12:34:22 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZfGdDlTO-PCk; Thu, 27 Oct 2011 12:34:13 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 07631CB0266; Thu, 27 Oct 2011 12:34:06 +0200 (CEST) From: Eric Botcazou To: David Miller Subject: Re: Reload related segfaults Date: Thu, 27 Oct 2011 12:01:00 -0000 User-Agent: KMail/1.9.9 Cc: amodra@gmail.com, gcc-patches@gcc.gnu.org References: <20111027025956.GQ29439@bubble.grove.modra.org> <20111026.230711.1078076406757764801.davem@davemloft.net> <20111027.024029.1691741697599158961.davem@davemloft.net> In-Reply-To: <20111027.024029.1691741697599158961.davem@davemloft.net> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_yNTqOscPwIo7oo+" Message-Id: <201110271233.22790.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02451.txt.bz2 --Boundary-00=_yNTqOscPwIo7oo+ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1045 > The crash is in find_valid_class() called from push_reload(), via this > code block around line 1184 of reload.c: > > enum reg_class in_out_class > = find_valid_class (outmode, GET_MODE (SUBREG_REG (out)), > subreg_regno_offset (REGNO (SUBREG_REG (out)), > GET_MODE (SUBREG_REG (out)), > SUBREG_BYTE (out), > GET_MODE (out)), > REGNO (SUBREG_REG (out))); > > 'out' is: > > (subreg:DI (reg/v:V4QI 50 %f18 [orig:314 s2hi4_ ] [314]) 0) > > so subreg_regno_offset() returns -1, and find_valid_class() isn't too happy > about getting "-1" for it's 'n' argument. OK, Alan's case is the same-sized and yours is the paradoxical one. Clearly we shouldn't have tried to change anything for them. Tentative fix attached, it should restore the old behavior for the cases where everything was working fine before. I'm going to give it some testing. PR rtl-optimization/46603 * reload.c (push_reload): In the out case, restore previous behavior for subregs that don't have word mode. -- Eric Botcazou --Boundary-00=_yNTqOscPwIo7oo+ Content-Type: text/x-diff; charset="iso 8859-15"; name="pr46603-2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr46603-2.diff" Content-length: 818 Index: reload.c =================================================================== --- reload.c (revision 180526) +++ reload.c (working copy) @@ -1140,6 +1140,14 @@ push_reload (rtx in, rtx out, rtx *inloc / UNITS_PER_WORD))) #endif )) + || (REG_P (SUBREG_REG (out)) + && REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER + /* The case of a word mode subreg + is handled differently in the following statement. */ + && ! (GET_MODE_SIZE (outmode) <= UNITS_PER_WORD + && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out))) + > UNITS_PER_WORD)) + && ! HARD_REGNO_MODE_OK (subreg_regno (out), outmode)) || (secondary_reload_class (0, rclass, outmode, out) != NO_REGS && (secondary_reload_class (0, rclass, GET_MODE (SUBREG_REG (out)), SUBREG_REG (out)) --Boundary-00=_yNTqOscPwIo7oo+--