You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash when compiling an exported declare function with a default parameter value #3046
Hi, I found that asc crashes while compiling the following code snippet. I would expect this to report a normal compilation error rather than crashing.
Steps to reproduce
// bad.tsexportdeclarefunctionf(x:i32=0):i32
> node ~/fuzz_emerging_compilers/AssemblyScript/assemblyscript/bin/asc --optimizeLevel 2 --shrinkLevel 2 bad.ts -o bad.wasm
▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is the stack trace hinting at the problem, perhaps it's useful?▌▌ RangeError: Invalid array length▌ at t.getNonParameterLocalTypes (.../assemblyscript/src/program.ts:3903:17)▌ at t.ensureVarargsStub (.../assemblyscript/src/compiler.ts:6692:24)▌ at t.compileModuleExport (.../assemblyscript/src/compiler.ts:984:37)▌ at t.compileModuleExport (.../assemblyscript/src/compiler.ts:972:18)▌ at t.compileModuleExports (.../assemblyscript/src/compiler.ts:951:14)▌ at t.compile (.../assemblyscript/src/compiler.ts:570:14)
Other findings
Removing either export or declare does not trigger the crash.
Removing the default parameter value does not trigger the crash:
Activity