From patchwork Wed Dec 12 19:58:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 205637 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 5D9CA2C008D for ; Thu, 13 Dec 2012 06:58:58 +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=1355947139; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc: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=HddwL3Wcit+tL0hrW+l0 DyndImg=; b=Bkl7htY/mMX7XrkWSATomX7vUEjqhYQzxvkfvMdZH8rU8XisJxwp SUJGFy+lH3X/+n2KXfLe3s3NH0UX6oF5qztxAS7UbzZGNBhdCwxuWgHAXd033eOE XzCILv7aRB24/EE/SYhH52DGUMTz0vRjy3nwEzU92gfvcUGk4EBA8RA= 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:Cc: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=uGLC4inKbDhVrEu9Bk/BNtsNi78gCWr3Pq1h0NnZIOWEy13ub9AIH+3/8IVyZW fkIfFHlxHQ3dfqtNeg+pVqKIpgaUbroWQzGE2+0OuRs3xjlqMTWwWlpy/SDKZX4u gqoXf7TinCfn5YbmcZi7kKiGebklFLNshYBBjyx5NzOPo=; Received: (qmail 12760 invoked by alias); 12 Dec 2012 19:58:55 -0000 Received: (qmail 12751 invoked by uid 22791); 12 Dec 2012 19:58:55 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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; Wed, 12 Dec 2012 19:58:50 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBCJwofH030073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Dec 2012 14:58:50 -0500 Received: from zalov.redhat.com (vpn1-5-150.ams2.redhat.com [10.36.5.150]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBCJwmmr025012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 12 Dec 2012 14:58:49 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qBCJwlmZ031242; Wed, 12 Dec 2012 20:58:47 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qBCJwl1d031241; Wed, 12 Dec 2012 20:58:47 +0100 Date: Wed, 12 Dec 2012 20:58:46 +0100 From: Jakub Jelinek To: Diego Novillo Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix nonlocalized vars regression caused by vec changes (PR debug/55665) Message-ID: <20121212195846.GG2315@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! Before http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193595 aka the big vec.h changes, nonlocalized_list parameter to remap_decls used to be **, but the changes changed it to *. That is a problem, because then there is no difference between the case where we don't want to push anything to nonlocalized_list (caller passes NULL) and calling it with BLOCK_NONLOCALIZED_VARS, which is empty. That resulted in vec_safe_push not being called, because nonlocalized_list test was false. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-12-12 Jakub Jelinek PR debug/55665 * tree-inline.c (remap_decls): Change nonlocalized_list to pointer to pointer to vector from pointer to vector. (remap_block): Pass address of BLOCK_NONLOCALIZED_VARS. * g++.dg/guality/pr55665.C: New test. Jakub --- gcc/tree-inline.c.jj 2012-11-19 14:41:26.000000000 +0100 +++ gcc/tree-inline.c 2012-12-12 18:23:31.937008538 +0100 @@ -536,7 +536,7 @@ can_be_nonlocal (tree decl, copy_body_da } static tree -remap_decls (tree decls, vec *nonlocalized_list, +remap_decls (tree decls, vec **nonlocalized_list, copy_body_data *id) { tree old_var; @@ -557,7 +557,7 @@ remap_decls (tree decls, vec DINFO_LEVEL_TERSE) && !DECL_IGNORED_P (old_var) && nonlocalized_list) - vec_safe_push (nonlocalized_list, old_var); + vec_safe_push (*nonlocalized_list, old_var); continue; } @@ -575,7 +575,7 @@ remap_decls (tree decls, vec DINFO_LEVEL_TERSE) && !DECL_IGNORED_P (old_var) && nonlocalized_list) - vec_safe_push (nonlocalized_list, old_var); + vec_safe_push (*nonlocalized_list, old_var); } else { @@ -622,7 +622,7 @@ remap_block (tree *block, copy_body_data /* Remap its variables. */ BLOCK_VARS (new_block) = remap_decls (BLOCK_VARS (old_block), - BLOCK_NONLOCALIZED_VARS (new_block), + &BLOCK_NONLOCALIZED_VARS (new_block), id); if (id->transform_lang_insert_block) --- gcc/testsuite/g++.dg/guality/pr55665.C.jj 2012-12-12 18:37:11.829241332 +0100 +++ gcc/testsuite/g++.dg/guality/pr55665.C 2012-12-12 18:34:59.000000000 +0100 @@ -0,0 +1,33 @@ +// PR debug/55655 +// { dg-do run } +// { dg-options "-g" } + +extern "C" void abort (); +struct A { A (int); int a; }; + +__attribute__((noinline, noclone)) int +bar (void) +{ + return 40; +} + +__attribute__((noinline, noclone)) void +foo (int x) +{ + __asm volatile ("" : : "r" (x) : "memory"); +} + +A::A (int x) +{ + static int p = bar (); + foo (p); // { dg-final { gdb-test 23 "p" "40" } } + a = ++p; +} + +int +main () +{ + A a (42); + if (a.a != 41) + abort (); +}