From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30224 invoked by alias); 26 Apr 2011 11:18:27 -0000 Received: (qmail 30214 invoked by uid 22791); 26 Apr 2011 11:18:25 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Apr 2011 11:18:11 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/48764] [4.5/4.6/4.7 Regression] wrong-code bug in gcc-4.5.x, related to __restrict X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.5.4 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 26 Apr 2011 11:18:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg02603.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48764 --- Comment #2 from Richard Guenther 2011-04-26 11:17:59 UTC --- The following fixes it (partially, global vars need similar treatment) at the cost of extra decls and points-to bits. We have to give what we point to a name, not only rely in the nonlocal glob. Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 172817) +++ gcc/tree-ssa-structalias.c (working copy) @@ -4727,8 +4727,27 @@ intra_create_variable_infos (void) } for (p = get_vi_for_tree (t); p; p = p->next) - if (p->may_have_pointers) - make_constraint_from (p, nonlocal_id); + { + if (p->may_have_pointers) + { + struct constraint_expr lhsc, rhsc; + tree heapvar; + heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)), + "PARM_PT"); + DECL_EXTERNAL (heapvar) = 1; + get_var_ann (heapvar)->is_heapvar = 1; + add_referenced_var (heapvar); + lhsc.var = p->id; + lhsc.type = SCALAR; + lhsc.offset = 0; + rhsc.var = get_vi_for_tree (heapvar)->id; + rhsc.type = ADDRESSOF; + rhsc.offset = 0; + process_constraint (new_constraint (lhsc, rhsc)); + + make_constraint_from (p, nonlocal_id); + } + } if (POINTER_TYPE_P (TREE_TYPE (t)) && TYPE_RESTRICT (TREE_TYPE (t))) make_constraint_from_restrict (get_vi_for_tree (t), "PARM_RESTRICT"); it would be nice if we could avoid allocating decls for such things (in principle we could simply allocate a DECL_UID only).