From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67152 invoked by alias); 8 Jun 2015 14:07:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 67142 invoked by uid 89); 8 Jun 2015 14:07:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 08 Jun 2015 14:07:47 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1C665ABB1 for ; Mon, 8 Jun 2015 14:07:44 +0000 (UTC) Date: Mon, 08 Jun 2015 14:09:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR66413 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-06/txt/msg00574.txt.bz2 We fail to unshare exprs put into debug stmts during inlinign which creates bogus tree sharing. Bootstrap and regtest pending on x86_64-unknown-linux-gnu. Richard. 2015-06-08 Richard Biener PR middle-end/66413 * tree-inline.c (insert_init_debug_bind): Unshare value. * gcc.dg/torture/pr66413.c: New testcase. Index: gcc/tree-inline.c =================================================================== *** gcc/tree-inline.c (revision 224221) --- gcc/tree-inline.c (working copy) *************** insert_init_debug_bind (copy_body_data * *** 3027,3033 **** base_stmt = gsi_stmt (gsi); } ! note = gimple_build_debug_bind (tracked_var, value, base_stmt); if (bb) { --- 3027,3033 ---- base_stmt = gsi_stmt (gsi); } ! note = gimple_build_debug_bind (tracked_var, unshare_expr (value), base_stmt); if (bb) { Index: gcc/testsuite/gcc.dg/torture/pr66413.c =================================================================== *** gcc/testsuite/gcc.dg/torture/pr66413.c (revision 0) --- gcc/testsuite/gcc.dg/torture/pr66413.c (working copy) *************** *** 0 **** --- 1,61 ---- + /* { dg-do compile } */ + /* { dg-additional-options "-g" } */ + + int a, b, c, d, i, j, q, *e, *h, *k, *r, **p = &e; + const int *f, **n = &f; + static int g; + + void + fn1 (int p1) + { + c = p1; + } + + static int * + fn2 (int *p1, const int *p2) + { + if (g) + n = &p2; + *n = p2; + int o[245]; + fn1 (o != p2); + return p1; + } + + static int * + fn3 () + { + int s[54], *t = &s[0], u = 0, v = 1; + h = &v; + q = 1; + for (; q; q++) + { + int *w[] = { &u }; + for (; v;) + return *p; + } + *r = *t + b >= 0; + return *p; + } + + static int + fn4 (int *p1) + { + int *l[2], **m[7]; + for (; i < 1; i++) + for (; j < 1; j++) + m[i * 70] = &l[0]; + k = fn3 (); + fn2 (0, p1); + if ((m[0] == 0) & a) + for (;;) + ; + return 0; + } + + int + main () + { + fn4 (&d); + return 0; + }