From patchwork Mon Jul 7 14:20:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 367584 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 88A6F140087 for ; Tue, 8 Jul 2014 00:23:03 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=WwLGq4wdg78MxkKlFqZ9c3qIaZlgkHseLVJBi+jHnvQvk7C80nYvp BtVfjGq5AulPT1K71gWm4zjMQoB28B4YL2CqOlsqxXMKKI+JFz30eLYiHNIsPzRF IJPPI/vqAOW5Om4EwdDBAy1bsdjC+YW2T4AHTewdpAv7KnTOwwox/c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=dINhl6di7TL2EfjLXuqOu7mQZXk=; b=AfWGZcXFgO7S4Z2bepUG uc/7aOO0AjA2F4Rg0MFICeOHD7QCiF60EucKQ45OYZSIYuC/yJc7iDDZDydKyjCD zjsEXkxtewZbaQv3yHHzUg8HDz81VeK7HVmA9azHnJEqMvm6LQ5xw8nnSaIz6Io+ i0x8ZTEKTe1jOVg54kJZzFQ= Received: (qmail 25290 invoked by alias); 7 Jul 2014 14:22:53 -0000 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 Received: (qmail 25225 invoked by uid 89); 7 Jul 2014 14:22:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham 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, 07 Jul 2014 14:22:50 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 946AFABE3 for ; Mon, 7 Jul 2014 14:22:47 +0000 (UTC) Date: Mon, 7 Jul 2014 16:20:06 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR61681 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 When simplifying the points-to-set comparison I failed to realize we don't expand ESCAPED special vars. The following does that for the only interesting one (NONLOCAL). Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Will apply to trunk and 4.9 branch if that succeeds. Richard. 2014-07-07 Richard Biener PR tree-optimization/61681 * tree-ssa-structalias.c (find_what_var_points_to): Expand NONLOCAL inside ESCAPED. * gcc.dg/torture/pr61681.c: New testcase. Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 212323) +++ gcc/tree-ssa-structalias.c (working copy) @@ -6106,6 +6106,10 @@ find_what_var_points_to (varinfo_t orig_ pt->ipa_escaped = 1; else pt->escaped = 1; + /* Expand some special vars of ESCAPED in-place here. */ + varinfo_t evi = get_varinfo (find (escaped_id)); + if (bitmap_bit_p (evi->solution, nonlocal_id)) + pt->nonlocal = 1; } else if (vi->id == nonlocal_id) pt->nonlocal = 1; Index: gcc/testsuite/gcc.dg/torture/pr61681.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr61681.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr61681.c (working copy) @@ -0,0 +1,37 @@ +/* { dg-do run } */ + +extern void abort (void); + +int a = 1, *e = &a, **f = &e, *l, *p, j; +static int b; +long d; +short g; + +void +fn1 (int *p) +{ + int m; + if (!(*p & j)) + { + int *n = &m; + for (d = 6; d; d--) + { + for (g = 0; g < 1; g++) + { + n = l = *f; + b = *p; + } + *n = 0; + } + } +} + +int +main () +{ + p = *f; + fn1 (p); + if (b != 0) + abort (); + return 0; +}