File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,16 @@ if (HAVE_BUILD_TO_WASM)
56
56
# "-s ALLOW_MEMORY_GROWTH": Allow dynamic memory growth upto the maximum page size limit
57
57
# "-s WASM_BIGINT": Allow use of i64 integers. ASR is needing this option to be enabled.
58
58
# "-s EXPORTED_RUNTIME_METHODS=['cwrap']": Export cwarp. cwarp helps us to call our EMSCRIPTEN_KEEPALIVE functions
59
+ # "-fsanitize=undefined": Clang's Undefined Behaviour Sanitizer. The LPython parser segfaults.
60
+ # This option is for debugging, but currently helps avoid the segfault in the parser.
61
+ # "-s INITIAL_MEMORY=536870912": Start the wasm linear memory with sufficiently large size 512Mb.
59
62
60
63
# Notes:
61
64
# STANDALONE_WASM is disabling support for exceptions, so it is currently omitted
62
65
# In build_to_wasm.sh, we need CMAKE_CXX_FLAGS_DEBUG="-Wall -Wextra -fexceptions" flags for exception support
63
- set (WASM_COMPILE_FLAGS "-g0 -fexceptions" )
66
+ set (WASM_COMPILE_FLAGS "-g0 -fexceptions -fsanitize=undefined " )
64
67
set (WASM_LINK_FLAGS
65
- "-g0 -Oz -fexceptions -- preload-file asset_dir -Wall -Wextra --no-entry -s ASSERTIONS -s ALLOW_MEMORY_GROWTH=1 -s WASM_BIGINT -s \" EXPORTED_RUNTIME_METHODS=['cwrap']\" "
68
+ "-g0 -Oz -fexceptions -fsanitize=undefined -- preload-file asset_dir -Wall -Wextra --no-entry -sASSERTIONS=1 -s INITIAL_MEMORY=536870912 -s ALLOW_MEMORY_GROWTH=1 -s WASM_BIGINT -s \" EXPORTED_RUNTIME_METHODS=['cwrap']\" "
66
69
)
67
70
set_target_properties (lpython PROPERTIES COMPILE_FLAGS ${WASM_COMPILE_FLAGS} )
68
71
set_target_properties (lpython PROPERTIES LINK_FLAGS ${WASM_LINK_FLAGS} )
You can’t perform that action at this time.
0 commit comments