https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119718
--- Comment #13 from lucier at math dot purdue.edu --- This is the change I made to report warnings when was maybe_complain_about_tail_call called: heine:~/programs/gcc/gcc-mainline/gcc> git diff diff --git a/gcc/calls.cc b/gcc/calls.cc index b3dccd85ec8..b78b79db271 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -1273,11 +1273,13 @@ void maybe_complain_about_tail_call (tree call_expr, const char *reason) { gcc_assert (TREE_CODE (call_expr) == CALL_EXPR); - if (!CALL_EXPR_MUST_TAIL_CALL (call_expr)) - return; - - error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason); + if (CALL_EXPR_MUST_TAIL_CALL (call_expr)) + error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason); + else if (flag_optimize_sibling_calls) + warning (OPT_Wdisabled_optimization, + "cannot apply sibling-call optimization: %s", reason); CALL_EXPR_MUST_TAIL_CALL (call_expr) = 0; + return; } /* Fill in ARGS_SIZE and ARGS array based on the parameters found in