From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21879 invoked by alias); 6 Oct 2004 21:00:58 -0000 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 Received: (qmail 21855 invoked by uid 48); 6 Oct 2004 21:00:57 -0000 Date: Wed, 06 Oct 2004 21:00:00 -0000 Message-ID: <20041006210057.21853.qmail@sourceware.org> From: "dpatel at apple dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040715015458.16558.snyder@fnal.gov> References: <20040715015458.16558.snyder@fnal.gov> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/16558] [4.0 Regression]: bogus missing-return warning X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg00773.txt.bz2 List-Id: ------- Additional Comments From dpatel at apple dot com 2004-10-06 21:00 ------- In gimple-low.c, we have 88 /* If the function falls off the end, we need a null return statement. 89 If we've already got one in the return_statements list, we don't 90 need to do anything special. Otherwise build one by hand. */ 91 if (block_may_fallthru (*body_p) 92 && (data.return_statements == NULL 93 || TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL)) 94 { 95 x = build (RETURN_EXPR, void_type_node, NULL); 96 SET_EXPR_LOCATION (x, cfun->function_end_locus); 97 tsi_link_after (&i, x, TSI_CONTINUE_LINKING); 98 } And in tree-cfg.c, we have 5310 FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds) 5311 { 5312 tree last = last_stmt (e->src); 5313 if (TREE_CODE (last) == RETURN_EXPR 5314 && TREE_OPERAND (last, 0) == NULL) 5315 { 5316 #ifdef USE_MAPPED_LOCATION 5317 location = EXPR_LOCATION (last); 5318 if (location == UNKNOWN_LOCATION) 5319 location = cfun->function_end_locus; 5320 warning ("%Hcontrol reaches end of non-void function", &location); 5321 #else 5322 locus = EXPR_LOCUS (last); 5323 if (!locus) 5324 locus = &cfun->function_end_locus; 5325 warning ("%Hcontrol reaches end of non-void function", locus); 5326 #endif 5327 break; 5328 } 5329 } These two code fragements need to talk with each other. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16558