From patchwork Thu Aug 12 08:10:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 61544 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 B136EB70D4 for ; Thu, 12 Aug 2010 18:10:58 +1000 (EST) Received: (qmail 14800 invoked by alias); 12 Aug 2010 08:10:41 -0000 Received: (qmail 14712 invoked by uid 22791); 12 Aug 2010 08:10:37 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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, 12 Aug 2010 08:10:30 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7C8AROP019444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Aug 2010 04:10:28 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7C8ARlA032522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 12 Aug 2010 04:10:27 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id o7C8AS03026637 for ; Thu, 12 Aug 2010 10:10:28 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id o7C8ASaT026635 for gcc-patches@gcc.gnu.org; Thu, 12 Aug 2010 10:10:28 +0200 Date: Thu, 12 Aug 2010 10:10:28 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix VTA ICE (PR debug/45259) Message-ID: <20100812081028.GM702@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) 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 Hi! When fixing PR42918, I wasn't aware of reload chain pointing also to insns before basic block (like jump tables) with ->block number of the following bb. The moving of notes in that case is both completely unnecessary (as the jump tables etc. certainly can't cause any register saves, therefore there is nothing to restore), but doesn't work (both in that it tries to move around block notes and that it fails assertion because it sees CODE_LABEL or BARRIER insns, which is neither a NOTE nor DEBUG_INSN nor last->insn. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for trunk/4.5? 2010-08-12 Jakub Jelinek PR debug/45259 * caller-save.c (save_call_clobbered_regs): Only swap notes with DEBUG_INSNs if n_regs_saved. * gcc.dg/pr45259.c: New test. Jakub --- gcc/caller-save.c.jj 2010-08-11 21:08:06.000000000 +0200 +++ gcc/caller-save.c 2010-08-11 22:23:12.000000000 +0200 @@ -868,7 +868,10 @@ save_call_clobbered_regs (void) remain saved. If the last insn in the block is a JUMP_INSN, put the restore before the insn, otherwise, put it after the insn. */ - if (DEBUG_INSN_P (insn) && last && last->block == chain->block) + if (n_regs_saved + && DEBUG_INSN_P (insn) + && last + && last->block == chain->block) { rtx ins, prev; basic_block bb = BLOCK_FOR_INSN (insn); --- gcc/testsuite/gcc.dg/pr45259.c.jj 2010-08-11 22:12:19.000000000 +0200 +++ gcc/testsuite/gcc.dg/pr45259.c 2010-08-11 21:43:24.000000000 +0200 @@ -0,0 +1,42 @@ +/* PR debug/45259 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2 -fpic -w" { target fpic } } */ + +struct S { void (*bar) (long); }; +struct T { struct S *t; }; +int w; +extern int baz (int); + +void +foo (int x, int u, char *z) +{ + struct T *v; + static void *y[256] = { &&l1, &&l2 }; + for (;;) + switch (x) + { + l2: + x = 9; + case 9: + goto *y[*z++]; + case 10: + case 27: + case 54: + case 99: + case 100: + case 120: + case 122: + case 131: + case 132: + case 134: + case 141: + case 142: + v->t->bar (u); + v->t->bar (u); + case 143: + continue; + l1: + default: + baz (w); + } +}