From patchwork Tue Feb 14 17:00:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 141143 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 504771007D1 for ; Wed, 15 Feb 2012 04:00:37 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329843639; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Message-Id:Received:Subject:To:Date: From:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=pZc0MZzd3Zumv0CBBr1z h9EkYyc=; b=iSlW+VYzRd5JNfBaB5V+XTW9LfnImcmaSQrjvZbL05mmGTQfo5E3 gEcl4k6A3gLJvv6UyZPRSP6pr9h4Gvv/hJWBqFclpaj8bRxjn3jGUu0siYn3M/R3 NB53064DYjkjn6+H7OtHYwE8jSJ31UwPiUL0s7E7MgXVrmuId74kAlo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Message-Id:Received:Subject:To:Date:From:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:x-cbid:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=euF/6TRcl3YrqymCFoPtPyw4ohopE+jiHrTWwkxJI/ubrtKEJ5tBfQFhJR3Akf Xe/Gas0Ac9St+UPHy82zUQXl8DB3zAIgbikouZfyz8iHRBnu2xPu9TtZGe6/2G/0 dhSCcAHgoVbZ8RkBLpPZYcRTkqx+AiqTrWXCW1GxVa6Eo=; Received: (qmail 6298 invoked by alias); 14 Feb 2012 17:00:30 -0000 Received: (qmail 6280 invoked by uid 22791); 14 Feb 2012 17:00:28 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, MSGID_FROM_MTA_HEADER, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 17:00:14 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Feb 2012 17:00:13 -0000 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 14 Feb 2012 17:00:10 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1EH09uR2539762 for ; Tue, 14 Feb 2012 17:00:09 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1EH08x0000941 for ; Tue, 14 Feb 2012 10:00:08 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q1EH07hJ000850; Tue, 14 Feb 2012 10:00:07 -0700 Message-Id: <201202141700.q1EH07hJ000850@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 14 Feb 2012 18:00:06 +0100 Subject: [PATCH?, 4.7 regression] Crash in ira-costs.c with -fschedule-insns -fsched-pressure -fdump-rtl-sched1 To: gcc-patches@gcc.gnu.org Date: Tue, 14 Feb 2012 18:00:06 +0100 (CET) From: "Ulrich Weigand" Cc: vmakarov@redhat.com MIME-Version: 1.0 x-cbid: 12021417-8372-0000-0000-000001B47D31 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, compiling anything, even just an empty function, with -fschedule-insns -fsched-pressure -fdump-rtl-sched1 causes the compiler to crash: Program received signal SIGSEGV, Segmentation fault. 0x0840d9e0 in REG_N_REFS (regno=58) at ../../gcc-head/gcc/regs.h:75 75 return regstat_n_sets_and_refs[regno].refs; (gdb) bt #0 0x0840d9e0 in REG_N_REFS (regno=58) at ../../gcc-head/gcc/regs.h:75 #1 0x08411120 in print_pseudo_costs (f=0x8e3fad0) at ../../gcc-head/gcc/ira-costs.c:1433 #2 0x08412046 in find_costs_and_classes (dump_file=0x8e3fad0) at ../../gcc-head/gcc/ira-costs.c:1806 #3 0x084129f2 in ira_set_pseudo_classes (dump_file=0x8e3fad0) at ../../gcc-head/gcc/ira-costs.c:2067 #4 0x089a9f08 in sched_init () at ../../gcc-head/gcc/haifa-sched.c:4838 This is because sched_init calls ira_set_pseudo_classes without having called regstat_init_n_sets_and_refs first, but the latter is a prerequisite for using REG_N_REFS. All other callers of ira_set_pseudo_classes seem to initialize the regstat array first. This is fixed by the following patch. However, I'm not quite sure if this is the best way to fix the problem, given that the REG_N_REFS use occurs only for debug output purposes -- should we actually do the work to compute the regstat array just for that, or can print_pseudo_costs be changed instead? Bye, Ulrich ChangeLog: * haifa-sched.c (sched_init): Call regstat_init_n_sets_and_refs and regstat_free_n_sets_and_refs before/after ira_set_pseudo_classes call. === modified file 'gcc/haifa-sched.c' --- gcc/haifa-sched.c 2012-02-11 01:34:30 +0000 +++ gcc/haifa-sched.c 2012-02-14 16:41:47 +0000 @@ -6281,7 +6281,9 @@ { int i, max_regno = max_reg_num (); + regstat_init_n_sets_and_refs (); ira_set_pseudo_classes (sched_verbose ? sched_dump : NULL); + regstat_free_n_sets_and_refs (); sched_regno_pressure_class = (enum reg_class *) xmalloc (max_regno * sizeof (enum reg_class)); for (i = 0; i < max_regno; i++)