# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #! CHECKER Stack overflow #! RUN force_jit: true, options: "--compiler-regex _GLOBAL::__noinline__inc_recursive", entry: "_GLOBAL::main", result: 0 #! EVENT /Compilation,_GLOBAL::__noinline__inc_recursive,.*,COMPILED/ #.language Java #.record java.lang.StackOverflowError .record panda.StackOverflowException .function i32 __noinline__inc_recursive(i32 a0) { inci a0, 1 call.short __noinline__inc_recursive, a0 return } .function i32 main() { try_begin: movi v0, 0 call.short __noinline__inc_recursive, v0 ldai 1 return try_end: catch_all_begin: ldai 1 return catch_stackoverflow_begin: ldai 0 return .catch panda.StackOverflowException, try_begin, try_end, catch_stackoverflow_begin .catchall try_begin, try_end, catch_all_begin } #! CHECKER Stack overflow unhandled #! RUN force_jit: true, options: "--compiler-regex _GLOBAL::__noinline__inc_recursive", entry: "_GLOBAL::main_no_catch", result: 1 #! EVENT /Compilation,_GLOBAL::__noinline__inc_recursive,.*,COMPILED/ .function i32 main_no_catch() { movi v0, 0 call.short __noinline__inc_recursive, v0 ldai 0 return }