From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15928 invoked by alias); 25 Jan 2005 16:56:38 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 15902 invoked by uid 48); 25 Jan 2005 16:56:32 -0000 Date: Tue, 25 Jan 2005 16:56:00 -0000 From: "rguenth at tat dot physik dot uni-tuebingen dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20050125165629.19626.rguenth@tat.physik.uni-tuebingen.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/19626] New: Aliasing says stores to local memory do alias X-Bugzilla-Reason: CC X-SW-Source: 2005-01/txt/msg03716.txt.bz2 List-Id: Given the attached testcase, for reference, the interesting function is this: int loc_test(void) { const Loc<2> dX(1, 0); const Loc<2> k(0, 1); return k[0].first() + dX[0].first(); } aliasing tells us that the initializations of dX and k alias each other: : D.2540 = (struct Loc<1> *) &dX.D.2210.D.2166.domain_m.buffer; # dX_357 = V_MAY_DEF ; # k_358 = V_MAY_DEF ; *&(&D.2540->D.2094)->D.2057.domain_m = 1; # dX_365 = V_MAY_DEF ; # k_364 = V_MAY_DEF ; *&(&(D.2540 + 4B)->D.2094)->D.2057.domain_m = 0; D.2682 = (struct Loc<1> *) &k.D.2210.D.2166.domain_m.buffer; # dX_337 = V_MAY_DEF ; # k_338 = V_MAY_DEF ; *&(&D.2682->D.2094)->D.2057.domain_m = 0; # dX_361 = V_MAY_DEF ; # k_63 = V_MAY_DEF ; *&(&(D.2682 + 4B)->D.2094)->D.2057.domain_m = 1; D.2769 = (struct Loc<1> *) &k.D.2210.D.2166.domain_m.buffer; D.2791 = (struct Loc<1> *) &dX.D.2210.D.2166.domain_m.buffer; return (&D.2769->D.2094)->D.2057.domain_m + (&D.2791->D.2094)->D.2057.domain_m; which is of course (trivially) not true. This may be obfuscated by the actual implementation of the template class Loc (see attached complete testcase). At the RTL level we are able to optimize this to just return 1, as expected. This pessimizes tree loop optimizations if such constructs are used inside a loop and as induction variable. -- Summary: Aliasing says stores to local memory do alias Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19626