Skip to content

Commit

Permalink
disable tail-call for gcc
Browse files Browse the repository at this point in the history
fix an infinite loop in consume_stack1
  • Loading branch information
yamt committed Apr 25, 2024
1 parent 3c9c444 commit dd6e020
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/native-stack-overflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GRE
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-usage")
endif ()

# GCC doesn't have disable_tail_calls attribute
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-optimize-sibling-calls")
endif ()

# build out vmlib
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
Expand Down

0 comments on commit dd6e020

Please sign in to comment.