diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-04-02 18:18:50 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2025-04-04 09:01:54 -0700 |
commit | ae4c22ab05501940e345ee799be3aa36ffa7269a (patch) | |
tree | 92c24f17deac6ab4d6492b27c95c7d226d0d5a11 /libjava/classpath/lib/java | |
parent | aa9d3f17ff359ecad729a9436adbbf644aab2426 (diff) | |
download | gcc-ae4c22ab05501940e345ee799be3aa36ffa7269a.zip gcc-ae4c22ab05501940e345ee799be3aa36ffa7269a.tar.gz gcc-ae4c22ab05501940e345ee799be3aa36ffa7269a.tar.bz2 |
always turn return into __builtin_unreachable for noreturn fuctions [PR119599]
r8-3988-g356fcc67fba52b added code to turn return statements into __builtin_unreachable
calls inside noreturn functions but only while optimizing. Since -funreachable-traps
was added (r13-1204-gd68d3664253696), it is a good idea to move over to using
__builtin_unreachable (and the trap version with this option which defaults at -O0 and -0g)
instead of just a follow through even at -O0.
This also fixes a regression when inlining a noreturn function that returns at -O0 (due to always_inline)
as we would get an empty bb which has no successor edge instead of one with a call to __builtin_unreachable.
I also noticed there was no testcase testing the warning about __builtin_return inside a noreturn function
so I added a testcase there.
Bootstrapped and tested on x86_64-linux-gnu.
PR ipa/119599
gcc/ChangeLog:
* tree-cfg.cc (pass_warn_function_return::execute): Turn return statements always
into __builtin_unreachable calls.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr119599-1.c: New test.
* gcc.dg/builtin-apply5.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libjava/classpath/lib/java')
0 files changed, 0 insertions, 0 deletions