From patchwork Wed May 11 13:03:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hariharan Sandanagobalane X-Patchwork-Id: 95187 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]) by ozlabs.org (Postfix) with SMTP id 64EF1B6F5A for ; Thu, 12 May 2011 08:03:54 +1000 (EST) Received: (qmail 17720 invoked by alias); 11 May 2011 13:03:52 -0000 Received: (qmail 17710 invoked by uid 22791); 11 May 2011 13:03:51 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from gw-ba1.picochip.com (HELO thurne.picochip.com) (94.175.234.108) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 13:03:36 +0000 Received: from haddeo.picochip.com (haddeo.ubc.picochip.com [172.18.3.47]) (authenticated bits=0) by thurne.picochip.com (8.13.8/8.13.8) with ESMTP id p4BD3M7Z029728; Wed, 11 May 2011 14:03:22 +0100 Message-ID: <4DCA8926.9030106@picochip.com> Date: Wed, 11 May 2011 14:03:34 +0100 From: Hari Sandanagobalane User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.1 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" , Vladimir Makarov Subject: [Patch, IRA] Fix a function accessing beyond end-of-array 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 Hello, I discussed this problem with Vlad in http://gcc.gnu.org/ml/gcc/2011-05/msg00131.html. I propose the following patch to fix it. Okay to commit? Thanks Hari ChangeLog: * ira.c (clarify_prohibited_class_mode_regs): It was running beyond the end of REGNO_REG_CLASS array. Fixed. Patch: for (nregs-- ;nregs >= 0; nregs--) if (((enum reg_class) pclass Index: gcc/ira.c =================================================================== --- gcc/ira.c (revision 173654) +++ gcc/ira.c (working copy) @@ -1422,6 +1422,12 @@ if (TEST_HARD_REG_BIT (ira_prohibited_class_mode_regs[cl][j], hard_regno)) continue; nregs = hard_regno_nregs[hard_regno][j]; + if (hard_regno + nregs >= FIRST_PSEUDO_REGISTER) + { + SET_HARD_REG_BIT (ira_prohibited_class_mode_regs[cl][j], + hard_regno); + continue; + } pclass = ira_pressure_class_translate[REGNO_REG_CLASS (hard_regno)];