From: Wilco Dijkstra Date: Thu, 18 May 2017 15:58:33 +0000 (+0000) Subject: Add an assert to leaf_function_p to ensure it is not called from a prolog or... X-Git-Tag: upstream/12.2.0~39395 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00d600138536a4978f40b25233c2f37c0fc426d4;p=platform%2Fupstream%2Fgcc.git Add an assert to leaf_function_p to ensure it is not called from a prolog or... Add an assert to leaf_function_p to ensure it is not called from a prolog or epilog sequence (which would incorrectly return true in a non-leaf function). There are several targets which still call leaf_function_p, and while most appear safe or appear aware of the issue, it is likely not all such calls are safe. This check enables any such latent bugs to be found. gcc/ * final.c (leaf_function_p): Check we are not in a sequence. From-SVN: r248240 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f276258..a9a861e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-05-18 Wilco Dijkstra + + * final.c (leaf_function_p): Check we are not in a sequence. + 2017-05-18 Martin Liska * cfgrtl.c (rtl_verify_edges): Remove usage of TDF_RTL. diff --git a/gcc/final.c b/gcc/final.c index 820162b..e61b78b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4309,6 +4309,9 @@ leaf_function_p (void) { rtx_insn *insn; + /* Ensure we walk the entire function body. */ + gcc_assert (!in_sequence_p ()); + /* Some back-ends (e.g. s390) want leaf functions to stay leaf functions even if they call mcount. */ if (crtl->profile && !targetm.keep_leaf_when_profiled ())