diff options
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 413d7a9fb97..2a9e9d2d70e 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3814,7 +3814,7 @@ static bool verify_gimple_return (gimple stmt) { tree op = gimple_return_retval (stmt); - tree restype = TREE_TYPE (TREE_TYPE (cfun->decl)); + tree restype = function_return_type (cfun->decl); /* We cannot test for present return values as we do not fix up missing return values from the original source. */ @@ -7294,10 +7294,11 @@ execute_warn_function_return (void) /* If we see "return;" in some basic block, then we do reach the end without returning a value. */ - else if (warn_return_type + else if ((warn_return_type + || DECL_IS_IFUNC (cfun->decl)) && !TREE_NO_WARNING (cfun->decl) && EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0 - && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (cfun->decl)))) + && !VOID_TYPE_P (function_return_type (cfun->decl))) { FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds) { @@ -7309,7 +7310,12 @@ execute_warn_function_return (void) location = gimple_location (last); if (location == UNKNOWN_LOCATION) location = cfun->function_end_locus; - warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function"); + if (DECL_IS_IFUNC (cfun->decl)) + error_at (location, + "control reaches end of indirect function"); + else + warning_at (location, OPT_Wreturn_type, + "control reaches end of non-void function"); TREE_NO_WARNING (cfun->decl) = 1; break; } |