From patchwork Thu Nov 3 03:21:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 123388 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 E4DD7B6F8C for ; Thu, 3 Nov 2011 14:22:23 +1100 (EST) Received: (qmail 1752 invoked by alias); 3 Nov 2011 03:22:05 -0000 Received: (qmail 1738 invoked by uid 22791); 3 Nov 2011 03:22:02 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Nov 2011 03:21:46 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA33Ljxx001869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Nov 2011 23:21:45 -0400 Received: from greed.delorie.com ([10.3.113.14]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA33Lj6t019321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 2 Nov 2011 23:21:45 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id pA33LekX029377 for ; Wed, 2 Nov 2011 23:21:41 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id pA33LdBb029373; Wed, 2 Nov 2011 23:21:39 -0400 Date: Wed, 2 Nov 2011 23:21:39 -0400 Message-Id: <201111030321.pA33LdBb029373@greed.delorie.com> From: DJ Delorie To: gcc-patches@gcc.gnu.org Subject: increase call_saved_regs[] in caller-save.c X-IsSubscribed: yes 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 I found this with the rl78-elf port... can't guarantee it's not the rl78 port itself, but the code does have two loops that fill the array. * caller-save.c (setup_save_areas): Increase call_saved_regs[] size to avoid writing beyond the end of the array. There are two loops that iterate over hard regs and potentially add to this array, so it must hold a max of 2x the hard regs. Index: gcc/caller-save.c =================================================================== --- gcc/caller-save.c (revision 180758) +++ gcc/caller-save.c (working copy) @@ -494,13 +494,13 @@ setup_save_areas (void) { rtx slot; char *saved_reg_conflicts; int next_k; struct saved_hard_reg *saved_reg2, *saved_reg3; int call_saved_regs_num; - struct saved_hard_reg *call_saved_regs[FIRST_PSEUDO_REGISTER]; + struct saved_hard_reg *call_saved_regs[FIRST_PSEUDO_REGISTER*2]; int best_slot_num; int prev_save_slots_num; rtx prev_save_slots[FIRST_PSEUDO_REGISTER]; /* Find saved hard register conflicts. */ saved_reg_conflicts = (char *) xmalloc (saved_regs_num * saved_regs_num);