From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6339 invoked by alias); 28 Jul 2007 15:03:57 -0000 Received: (qmail 6330 invoked by uid 22791); 28 Jul 2007 15:03:56 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 28 Jul 2007 15:03:52 +0000 Received: from zps18.corp.google.com (zps18.corp.google.com [172.25.146.18]) by smtp-out.google.com with ESMTP id l6SF3m76017544 for ; Sat, 28 Jul 2007 08:03:48 -0700 Received: from frodo.local ([172.29.122.245]) by zps18.corp.google.com with ESMTP id l6SF3ic9027627 for ; Sat, 28 Jul 2007 08:03:44 -0700 Message-ID: <46AB5AD6.9050909@google.com> Date: Sat, 28 Jul 2007 16:34:00 -0000 From: Diego Novillo User-Agent: Thunderbird 2.0.0.5 (Macintosh/20070716) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [tuples] Assert that GIMPLE_RETURN is returning a gimple value Content-Type: multipart/mixed; boundary="------------040107060803050808000403" X-IsSubscribed: yes 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: 2007-07/txt/msg02037.txt.bz2 This is a multi-part message in MIME format. --------------040107060803050808000403 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 186 We no longer support return statements with an assignment to RESULT_DECL in the returned expression. This will need more fixes when we are expanding to RTL, but we're not there yet. --------------040107060803050808000403 Content-Type: text/x-patch; name="20070728-no-modify_expr-in-return.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="20070728-no-modify_expr-in-return.diff" Content-length: 2273 2007-07-28 Diego Novillo * gimplify.c (gimplify_return_expr): Do not create a MODIFY_EXPR as return argument * gimple.c (build_gimple_return): Assert that the returned value is a GIMPLE value. Index: gimplify.c =================================================================== --- gimplify.c (revision 127002) +++ gimplify.c (working copy) @@ -1132,10 +1132,9 @@ gimplify_return_expr (tree stmt, gimple_ || TREE_CODE (ret_expr) == RESULT_DECL || ret_expr == error_mark_node) { - gimple_add (pre_p, - build_gimple_return (ret_expr - && TREE_CODE (ret_expr) == RESULT_DECL, - ret_expr)); + bool use_return_decl_p = ret_expr && TREE_CODE (ret_expr) == RESULT_DECL; + gimple ret = build_gimple_return (use_return_decl_p, ret_expr); + gimple_add (pre_p, ret); return GS_ALL_DONE; } @@ -1144,8 +1143,9 @@ gimplify_return_expr (tree stmt, gimple_ else { result_decl = GENERIC_TREE_OPERAND (ret_expr, 0); + + /* See through a return by reference. */ if (TREE_CODE (result_decl) == INDIRECT_REF) - /* See through a return by reference. */ result_decl = TREE_OPERAND (result_decl, 0); gcc_assert ((TREE_CODE (ret_expr) == MODIFY_EXPR @@ -1190,14 +1190,7 @@ gimplify_return_expr (tree stmt, gimple_ gimplify_and_add (TREE_OPERAND (stmt, 0), pre_p); - /* If we didn't use a temporary, then the result is just the result_decl. - Otherwise we need a simple copy. This should already be gimple. */ - if (result == result_decl) - ret_expr = result; - else - ret_expr = build_gimple_modify_stmt (result_decl, result); - - gimple_add (pre_p, build_gimple_return (result == result_decl, ret_expr)); + gimple_add (pre_p, build_gimple_return (result == result_decl, result)); return GS_ALL_DONE; } Index: gimple.c =================================================================== --- gimple.c (revision 127002) +++ gimple.c (working copy) @@ -145,6 +145,7 @@ gimple build_gimple_return (bool result_decl_p, tree retval) { gimple s = build_gimple_with_ops (GIMPLE_RETURN, (int) result_decl_p, 1); + gcc_assert (is_gimple_val (retval)); gimple_return_set_retval (s, retval); return s; } --------------040107060803050808000403--