Skip to content

SIMD splat causes compiler error #1409

Closed
@postspectacular

Description

@postspectacular

I've just been trying to upgrade my assemblyscript dependency from 0.9.4 to 0.14.3 and am now getting a not very informative compiler error for code which worked completely fine in the older version. After various back and fro, removing code in my project and slowly going back with trying older assemblyscript versions, I managed to narrow it down and replicate the issue first appearing in assemblyscript 0.10.0 and using this small test function:

export function foo(out: usize): usize {
    const one = f32x4.splat(1);
    v128.store(out, one);
    return out;
}

Btw. In the actual code base this issue arises in this function..

asc assembly/index.ts -b simd.wasm -t simd.wat --optimize --enable simd --runtime none --importMemory --memoryBase 0

Error [AssertionError]: assertion failed
    at assert (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/std/portable/index.js:193:9)
    at m.compileVariableStatement (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:3093:17)
    at m.compileStatement (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:2145:21)
    at m.compileStatements (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:2193:23)
    at m.compileFunctionBody (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:1502:20)
    at m.compileFunction (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:1428:16)
    at m.compileElement (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:878:38)
    at m.compileExports (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:919:62)
    at m.compileExports (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:927:14)
    at m.compile (<...>/node_modules/assemblyscript/dist/webpack:/assemblyscript/src/compiler.ts:445:14)

<...>/node_modules/binaryen/index.js:57
function r(b){if(a.onAbort)a.onAbort(b);v(b);Aa=!0;throw new za("abort("+b+"). Build with -s ASSERTIONS=1 for more info.");}function Wa(b){var f=Xa;return String.prototype.startsWith?b.startsWith(f):0===b.indexOf(f)}var Xa="data:application/octet-stream;base64,",Ya="";if(!Wa(Ya)){var Za=Ya;Ya=a.locateFile?a.locateFile(Za,q):q+Za}var $a,ab;La.push({ga:function(){bb()}});var K={},cb=[];
                                                         ^
Error: abort(AssertionError: assertion failed). Build with -s ASSERTIONS=1 for more info.
    at process.r (<...>/node_modules/binaryen/index.js:57:58)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions