From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14507 invoked by alias); 27 Aug 2006 15:41:52 -0000 Received: (qmail 13872 invoked by alias); 27 Aug 2006 15:41:40 -0000 Date: Sun, 27 Aug 2006 15:41:00 -0000 Message-ID: <20060827154140.13871.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/28778] [4.0/4.1/4.2 Regression] alias bug with cast and call clobbered In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dberlin at dberlin dot org" 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 X-SW-Source: 2006-08/txt/msg02359.txt.bz2 List-Id: ------- Comment #21 from dberlin at gcc dot gnu dot org 2006-08-27 15:41 ------- Subject: Re: [4.0/4.1/4.2 Regression] alias bug with cast and call clobbered > by noticing that if pt_anything is set, we indeed need to include all > addressable vars in the clobbering: > This is also equivalent to marking every addressable variable as clobbered whenever a function has any incoming pointers, as they will point to anything, and escape. I listed this as a conservatively correct solution in the email i sent to mark (Mark everything clobbered). > > So what do you think will happen when you add one level of indirection > > to the mess, and TBAA now prunes out *that* alias instead, so you miss > > it again? (IE break the chain of clobber transitivity one link in the > > other direcftion). > > Do you have a testcase in mind? Do you really want me to construct one? Hopefully this will suffice: Clobbering is a transitive property. given b = &e a = b c = a d = c a store to *d clobbers the values held by c, d, a, and b. We will start with the solution that *d is clobbered, and attempt to propagate it up the chain by following may-alias sets, till we mark e as clobbered. In this case, d, c, a, and b wll have e in their alias set, so we only need to see the alias-set of any one of them to get this correct. However, if you add levels of indirection, like b = &e a = &b c = &a d = &c The only way we will get to the fact that e can be clobbered is by following the may-alias sets of each variable, d->c->a->b until we get to something with e in the ma-yalias set. If you add the right casts in, TBAA will prune the addresses from the may-alias set of different variables, and you won't ever get all the way to marking e clobbered. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28778