1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14#! CHECKER Stack overflow 15#! RUN force_jit: true, options: "--compiler-regex _GLOBAL::__noinline__inc_recursive", entry: "_GLOBAL::main", result: 0 16#! EVENT /Compilation,_GLOBAL::__noinline__inc_recursive,.*,COMPILED/ 17 18#.language Java 19 20#.record java.lang.StackOverflowError <external> 21.record panda.StackOverflowException <external> 22 23.function i32 __noinline__inc_recursive(i32 a0) { 24 inci a0, 1 25 call.short __noinline__inc_recursive, a0 26 return 27} 28 29.function i32 main() { 30 31try_begin: 32 movi v0, 0 33 call.short __noinline__inc_recursive, v0 34 ldai 1 35 return 36try_end: 37 38catch_all_begin: 39 40 ldai 1 41 return 42 43catch_stackoverflow_begin: 44 ldai 0 45 return 46 47.catch panda.StackOverflowException, try_begin, try_end, catch_stackoverflow_begin 48.catchall try_begin, try_end, catch_all_begin 49} 50 51#! CHECKER Stack overflow unhandled 52#! RUN force_jit: true, options: "--compiler-regex _GLOBAL::__noinline__inc_recursive", entry: "_GLOBAL::main_no_catch", result: 1 53#! EVENT /Compilation,_GLOBAL::__noinline__inc_recursive,.*,COMPILED/ 54 55.function i32 main_no_catch() { 56 movi v0, 0 57 call.short __noinline__inc_recursive, v0 58 ldai 0 59 return 60} 61