From patchwork Sun Dec 27 19:09:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 561192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E5826140CB1 for ; Mon, 28 Dec 2015 06:10:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=CxpU+rel; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=qTrGO0cCdZ/LrKLO/mLDbjURIlKJUmLFaLKKgOaR/oLx0r9qHJ DXLLWfJ79nEJT3g1sw5BfLmJRPDY9zvCno1hoC8TjxbAL0LfTNbaOHNEUuWJ7Pv+ KBCAHxpx9wXCZUl9HwESz4ORMGH5p3xDKpCJBTEQjWEGyBVqE5yrmRKeU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type:mime-version; s= default; bh=oreBCMOXvIbA/jU/4YXZISd2TlA=; b=CxpU+relNIrxNUTTlsID 7DJvRCrPKaGIxMaJFAIqew5P8+swsXpySnIQZtNdu6qjGWixMzJxlx/vIlxirsEi vWvwZ2S6xwJWe2sId3L0ZfHwbiQKPI87bzQfGry9TyVnkkdck5x2NXAn65OSbWYj ulv9SfzMvJi3El17AlaOaYE= Received: (qmail 101230 invoked by alias); 27 Dec 2015 19:10:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 101213 invoked by uid 89); 27 Dec 2015 19:10:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*imgtec.com, chances, H*p:D*de, H*Ad:D*googlemail.com X-HELO: DUB004-OMC4S30.hotmail.com Received: from dub004-omc4s30.hotmail.com (HELO DUB004-OMC4S30.hotmail.com) (157.55.2.105) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA256 encrypted) ESMTPS; Sun, 27 Dec 2015 19:10:02 +0000 Received: from emea01-db3-obe.outbound.protection.outlook.com ([157.55.2.71]) by DUB004-OMC4S30.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sun, 27 Dec 2015 11:09:59 -0800 Received: from HE1PR07MB0908.eurprd07.prod.outlook.com (10.162.26.15) by HE1PR07MB1162.eurprd07.prod.outlook.com (10.163.178.16) with Microsoft SMTP Server (TLS) id 15.1.361.13; Sun, 27 Dec 2015 19:09:58 +0000 Received: from HE1PR07MB0905.eurprd07.prod.outlook.com (10.162.26.12) by HE1PR07MB0908.eurprd07.prod.outlook.com (10.162.26.15) with Microsoft SMTP Server (TLS) id 15.1.361.13; Sun, 27 Dec 2015 19:09:58 +0000 Received: from HE1PR07MB0905.eurprd07.prod.outlook.com ([10.162.26.12]) by HE1PR07MB0905.eurprd07.prod.outlook.com ([10.162.26.12]) with mapi id 15.01.0361.006; Sun, 27 Dec 2015 19:09:57 +0000 From: Bernd Edlinger To: "gcc-patches@gcc.gnu.org" CC: Matthew Fortune , Richard Sandiford Subject: [PATCH] Fix pr69012 ICE on building libgfortran for mips Date: Sun, 27 Dec 2015 19:09:57 +0000 Message-ID: authentication-results: imgtec.com; dkim=none (message not signed) header.d=none; imgtec.com; dmarc=none action=none header.from=hotmail.de; x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [7f9ks8TsdX64Cp61XkDAVP2FpPz4ij7K] x-microsoft-exchange-diagnostics: 1; HE1PR07MB0908; 23:ANVYd3xSpfhJSFQbK0CVHNIgorVJU9NIbPn+wqsRsa25q5oz+1bwCVqk6kP8CfYscCNIZohauG9+/+2MdXsBNHK3HgD08yWINTdSeCLu1gGTMoMIIhwqlVJSxf2GQfeGdZHAAJPLnBPmlKedNP+jLjXhbXAG2bzlaLtqoEBwhgXlwGYS5STwpvAcHrBfUiuRQpPFVf8R4nJ1g8R2GvmMhA==; 5:6odzObZ+Nz5NVLhnHb1O43UkTTarzbpGMLguxBmlZo8v+t0monV90Mk3qnVyRX5XaKaPAIbd9RbC5vs9/HzqkjejGRxjLBzJOyQRojeNCfOi5flWKI7QwAXhaA+fphBs5lE5B1y7satRIkOeboUp/g==; 24:zLi/t2Xffq4m8+lb7OZ+XIeurbp3I3nuCFcUAaUC081/4wFzP9PijeuZI7a0SJkuFjmTSgceFW1fxXEAWKAlYJu6hbrNeGs42j1YCGlgQN0= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR07MB0908; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(82015046); SRVR:HE1PR07MB0908; BCL:0; PCL:0; RULEID:; SRVR:HE1PR07MB0908; x-forefront-prvs: 0803A0241F x-forefront-antispam-report: SFV:NSPM; SFS:(7070004)(98900002); DIR:OUT; SFP:1901; SCL:1; SRVR:HE1PR07MB0908; H:HE1PR07MB0905.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Dec 2015 19:09:57.3150 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB0908 X-Microsoft-Exchange-Diagnostics: 1; HE1PR07MB1162; 2:DSXA+VCZshEbYFiXHV1bUKWcIy9gl/Jj7jAgc9bYA4xvI6n3EdXYrqux4IKKlyc/a+nOrntiqbXl/5iTjnV+eoFbkv9mklxXguv0QNp09vkuBBnejV36q1a4P7Sby2bmLcw9Fc/jELMHz2VCJEDbKQ==; 23:leOXlcto61as4y+pArz/E6lAvmdu215pPPV1l9Ph15YBFS8aD/hShm+NCe0ON8MnsuLyJXiA+OC2+tMmTb0y3ES6owC6lDEWYr5R5nrdLBgf2+IGufJx21HHFmtVqN3cNBbor0GU90apgGVPPXK2vbIl7xKb6EWAny0NOtZYv/0= X-OriginatorOrg: sct-15-1-318-9-msonline-outlook-efc2f.templateTenant Hi, the build of libgfortran and glibc for mips currently fails because we now evaluate mips_compute_frame_info more often than before. If any instruction uses the predicate cprestore_save_slot_operand or cprestore_load_slot_operand the function mips_cprestore_address_p calls mips_get_cprestore_base_and_offset which needs valid data in frame->args_size and frame->hard_frame_pointer_offset, but these are initialized after calling mips_global_pointer, which makes the function get_attr_got raise an ICE. This patch re-orders the frame structure initialization, to initialize the required data before calling mips_global_pointer. I built a cross-glibc and cross fortran and c++ compiler and verified that the ICE is actually gone. Is the patch ok for trunk? Thanks Bernd. 2015-12-27 Bernd Edlinger PR target/69012 * config/mips/mips.c (mips_compute_frame_info): Move call to mips_global_pointer after initialization of args_size and hard_frame_pointer_offset. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c (revision 231927) +++ gcc/config/mips/mips.c (working copy) @@ -10347,8 +10347,6 @@ mips_compute_frame_info (void) memset (frame, 0, sizeof (*frame)); size = get_frame_size (); - cfun->machine->global_pointer = mips_global_pointer (); - /* The first two blocks contain the outgoing argument area and the $gp save slot. This area isn't needed in leaf functions. We can also skip it if we know that none of the called functions will use this space. @@ -10377,6 +10375,17 @@ mips_compute_frame_info (void) } offset = frame->args_size + frame->cprestore_size; + /* MIPS16 code offsets the frame pointer by the size of the outgoing + arguments. This tends to increase the chances of using unextended + instructions for local variables and incoming arguments. */ + if (TARGET_MIPS16) + frame->hard_frame_pointer_offset = frame->args_size; + + /* The function mips_global_pointer walks all insns and some depend + on the predicate function mips_cprestore_address_p, which uses + frame->args_size and frame->hard_frame_pointer_offset. */ + cfun->machine->global_pointer = mips_global_pointer (); + /* Move above the local variables. */ frame->var_size = MIPS_STACK_ALIGN (size); offset += frame->var_size; @@ -10520,12 +10529,6 @@ mips_compute_frame_info (void) frame->acc_save_offset = frame->acc_sp_offset - offset; if (frame->num_cop0_regs > 0) frame->cop0_save_offset = frame->cop0_sp_offset - offset; - - /* MIPS16 code offsets the frame pointer by the size of the outgoing - arguments. This tends to increase the chances of using unextended - instructions for local variables and incoming arguments. */ - if (TARGET_MIPS16) - frame->hard_frame_pointer_offset = frame->args_size; } /* Return the style of GP load sequence that is being used for the