From patchwork Tue Nov 27 13:26:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 202216 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 40F5E2C0092 for ; Wed, 28 Nov 2012 00:26:17 +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=1354627577; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=RyitdEf/wUphc9YuuRJH 9RM3JLw=; b=U5Akp7jw5AWliQXP2kQq3/TYOnGaeAiv5NvzOjscrryNYdoSKn/9 rTfBFK1EboZYRghbDLKwqePj/vYXRCWxNMtAM+7UN4Pa/Y0bKwfzPfWwNKQ6Mfp9 PIYZkfN/q4cnDhAZ63eIRmMmKptAX1j0blxRt6/z8gOqCVbnzc1l0eM= 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:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mz1prPfzjEIOUwB0uRwDvWy8rArJxIYtKYoaAzfL3L3CxmTB2DTabh4bQ88nSp blPv1pPqxbAtJdehXdXDynIwk8R0dX0KxJMuICVKInUkmYfsE0gvvGufDZ7Wjcw7 5z3ZynvcAe87cuM4moHD4MyT9jOyhY49Qyl5nHqpe9qDM=; Received: (qmail 18263 invoked by alias); 27 Nov 2012 13:26:11 -0000 Received: (qmail 18239 invoked by uid 22791); 27 Nov 2012 13:26:10 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, 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; Tue, 27 Nov 2012 13:26:06 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qARDQ6xb024981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Nov 2012 08:26:06 -0500 Received: from zalov.redhat.com (vpn1-7-145.ams2.redhat.com [10.36.7.145]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qARDQ3CE002422 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 27 Nov 2012 08:26:05 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qARDQ2Cc019187 for ; Tue, 27 Nov 2012 14:26:03 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qARDQ2IU019186 for gcc-patches@gcc.gnu.org; Tue, 27 Nov 2012 14:26:02 +0100 Date: Tue, 27 Nov 2012 14:26:02 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix invalid asm goto error recovery (PR middle-end/52650) Message-ID: <20121127132602.GZ2315@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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! delete_insn_and_edges doesn't DTRT here, there is __builtin_unreachable after the invalid inline asm goto. Rather than changing the CFG and trying to figure out what to do to remove the bogus asm goto successfully, it seems much easier to just turn it into asm goto ("" : : : clobbers... : lab1...); i.e. clear template and inputs. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-11-27 Jakub Jelinek PR middle-end/52650 * function.c (instantiate_virtual_regs_in_insn): Don't delete invalid asm gotos, instead just clear their template and inputs. Jakub --- gcc/function.c.jj 2012-11-21 16:00:12.000000000 +0100 +++ gcc/function.c 2012-11-26 16:47:24.907472155 +0100 @@ -1738,7 +1738,18 @@ instantiate_virtual_regs_in_insn (rtx in if (!check_asm_operands (PATTERN (insn))) { error_for_asm (insn, "impossible constraint in %"); - delete_insn_and_edges (insn); + /* For asm goto, instead of fixing up all the edges + just clear the template and clear input operands + (asm goto doesn't have any output operands). */ + if (JUMP_P (insn)) + { + rtx asm_op = extract_asm_operands (PATTERN (insn)); + ASM_OPERANDS_TEMPLATE (asm_op) = ggc_strdup (""); + ASM_OPERANDS_INPUT_VEC (asm_op) = rtvec_alloc (0); + ASM_OPERANDS_INPUT_CONSTRAINT_VEC (asm_op) = rtvec_alloc (0); + } + else + delete_insn (insn); } } else