From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24374 invoked by alias); 14 Apr 2011 21:56:56 -0000 Received: (qmail 24362 invoked by uid 22791); 14 Apr 2011 21:56:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Apr 2011 21:56:50 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 605CCCB02D1; Thu, 14 Apr 2011 23:56:49 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TPBUT+-scb6e; Thu, 14 Apr 2011 23:56:46 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 51AF3CB0266; Thu, 14 Apr 2011 23:56:46 +0200 (CEST) From: Eric Botcazou To: Richard Guenther Subject: Re: [PATCH][RFC] Make called function type explicit, make function pointer type conversions useless Date: Fri, 15 Apr 2011 03:00:00 -0000 User-Agent: KMail/1.9.9 Cc: gcc-patches@gcc.gnu.org, Diego Novillo References: <201104141753.16423.ebotcazou@adacore.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_cx2pNR99kREx1lW" Message-Id: <201104142351.24063.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg01140.txt.bz2 --Boundary-00=_cx2pNR99kREx1lW Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 360 > I suppose your patch is ok, maybe with simply not wrapping the NOP_EXPR > around builtins. Here's what I've installed after bootstrapping/regtesting on x86_64-suse-linux. 2011-04-14 Eric Botcazou * cfgexpand.c (expand_call_stmt): Rematerialize the original function type if this is not a builtin function. -- Eric Botcazou --Boundary-00=_cx2pNR99kREx1lW Content-Type: text/x-diff; charset="iso 8859-15"; name="p.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.diff" Content-length: 1050 Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 172458) +++ cfgexpand.c (working copy) @@ -1837,11 +1837,9 @@ expand_gimple_cond (basic_block bb, gimp static void expand_call_stmt (gimple stmt) { - tree exp; - tree lhs = gimple_call_lhs (stmt); - size_t i; + tree exp, decl, lhs = gimple_call_lhs (stmt); bool builtin_p; - tree decl; + size_t i; exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3); @@ -1849,6 +1847,13 @@ expand_call_stmt (gimple stmt) decl = gimple_call_fndecl (stmt); builtin_p = decl && DECL_BUILT_IN (decl); + /* If this is not a builtin function, the function type through which the + call is made may be different from the type of the function. */ + if (!builtin_p) + CALL_EXPR_FN (exp) + = fold_build1 (NOP_EXPR, build_pointer_type (gimple_call_fntype (stmt)), + CALL_EXPR_FN (exp)); + TREE_TYPE (exp) = gimple_call_return_type (stmt); CALL_EXPR_STATIC_CHAIN (exp) = gimple_call_chain (stmt); --Boundary-00=_cx2pNR99kREx1lW--