From patchwork Thu Apr 14 19:00:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 91278 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 92D1AB6FC8 for ; Fri, 15 Apr 2011 05:01:07 +1000 (EST) Received: (qmail 12291 invoked by alias); 14 Apr 2011 19:01:04 -0000 Received: (qmail 12279 invoked by uid 22791); 14 Apr 2011 19:01:03 -0000 X-SWARE-Spam-Status: No, hits=-6.5 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, 14 Apr 2011 19:00:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3EJ0pL8004804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Apr 2011 15:00:51 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3EJ0oDJ023618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 14 Apr 2011 15:00:51 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p3EJ0m5s010419 for ; Thu, 14 Apr 2011 21:00:50 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p3EJ0msu010339 for gcc-patches@gcc.gnu.org; Thu, 14 Apr 2011 21:00:48 +0200 Date: Thu, 14 Apr 2011 21:00:47 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix unwind info with inline asm (PR middle-end/48597) Message-ID: <20110414190047.GP17079@tyan-ft48-01.lab.bos.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! void foo (void) { register long s __asm ("r13"); register long t __asm ("r14"); register long u __asm ("r15"); asm volatile ("xorq %%r12, %%r12" : : : "r12"); asm volatile ("xorq %0, %0" : "=r" (s)); asm volatile ("xorq %0, %0" : "=r" (t)); asm volatile ("xorq %0, %0" : "=r" (u)); } has wrong unwind info on x86_64-linux with -O2, the problem is that dwarf2_frame_debug isn't called on the inline asm which clobbers registers which have queued register saves. This leads to the queued register saves to be emitted only after all the inline asms, while they need to be flushed before the first inline asm that clobbers any of the registers. In the originally reported problem, there was just one inline asm early in the function and the bug was mitigated by the http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01557.html patch. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6? 2011-04-14 Jakub Jelinek PR middle-end/48597 * final.c (final_scan_insn): Call dwarf2out_frame_debug even for inline asm. Jakub --- gcc/final.c.jj 2011-04-11 19:26:53.000000000 +0200 +++ gcc/final.c 2011-04-14 14:09:05.602402069 +0200 @@ -2313,6 +2313,9 @@ final_scan_insn (rtx insn, FILE *file, i location_t loc; expanded_location expanded; + if (dwarf2out_do_frame ()) + dwarf2out_frame_debug (insn, false); + /* There's no telling what that did to the condition codes. */ CC_STATUS_INIT;