From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21845 invoked by alias); 16 May 2008 15:27:27 -0000 Received: (qmail 2093 invoked by uid 48); 16 May 2008 11:12:53 -0000 Date: Fri, 16 May 2008 15:27:00 -0000 Message-ID: <20080516111253.2092.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/13146] inheritance for nonoverlapping_component_refs_p In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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: 2008-05/txt/msg01216.txt.bz2 ------- Comment #11 from rguenth at gcc dot gnu dot org 2008-05-16 11:12 ------- C testcase: struct A { int i; }; struct B { struct A a; int j; }; int foo (struct A *p, struct B *q) { p->i = 0; q->j = 1; return p->i; } we should optimize this to return zero. The reasoning is that while p may access a part of *q we still can tell that q->j is not in that part. Thus for offset based disambiguation with two pointers we can in some cases find a common base. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |middle-end http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13146