From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26281 invoked by alias); 5 Jul 2010 19:02:29 -0000 Received: (qmail 23656 invoked by alias); 5 Jul 2010 19:02:11 -0000 Date: Mon, 05 Jul 2010 19:02:00 -0000 Message-ID: <20100705190211.23655.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/41355] Type of ADDR_EXPR in CALL_EXPR not rebuilt when function is cloned In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hubicka at ucw dot cz" 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: 2010-07/txt/msg00490.txt.bz2 ------- Comment #2 from hubicka at ucw dot cz 2010-07-05 19:02 ------- Subject: Re: Type of ADDR_EXPR in CALL_EXPR not rebuilt when function is cloned > It turns out that the problem is that when build_function_type_skip_args > creates > the new type, TYPE_POINTER_TO for the new type is still pointing to the old > type. > When gimple_call_set_fndecl is used to change the fndecl to one with less > arguments, an ADDR_EXPR is built. The type of the ADDR_EXPR is obtained from > the > TYPE_POINTER_TO field of the new type, and thus has type pointer-to-old-type > rather than pointer-to-new-type. I'm testing the following patch. The idea > here is that calling copy_node has no advantage. In spite of the comment, The conditional you removed is about case where METHOD_TYPE is passed and "this" pointer is not removed. In this case we still want to produce METHOD_TYPE just with args adjusted. I think this functionality should be preserved. Are attributes attached to decl (not type) also copied? Honza -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41355