Skip to content

asm2wasm crah #60

@sletz

Description

@sletz

Crash with the following command :

bin/asm2wasm noise.js

for:

(i0 = 0; (((i0 | 0) < 2) | 0); i0 = (((i0 | 0) + 1) | 0)) {
HEAP32[dsp + 0 + ((i0 | 0) << 2) >> 2] = 0;

Abort trap: 6

Noise.js file content is :

/* ------------------------------------------------------------
author: "Grame"
copyright: "(c)GRAME 2009"
license: "BSD"
name: "Noise"
version: "1.1"
Code generated with Faust 2.0.a41 (http://faust.grame.fr)
------------------------------------------------------------ */

function mydspModule(global, foreign, buffer) {

'use asm';

var HEAP32 = new global.Int32Array(buffer);
var HEAPF32 = new global.Float32Array(buffer);

var imul = global.Math.imul;
var log = global.Math.log;

function fmodf(x, y) { x = +x; y = +y; return +(x % y); }
function log10f(a) { a = +a; return +(+log(a) / +log(10.)); }

function getNumInputs(dsp) {
    dsp = dsp | 0;
    return 0;
}

function getNumOutputs(dsp) {
    dsp = dsp | 0;
    return 1;
}

function classInit(dsp, samplingFreq) {
    dsp = dsp | 0;
    samplingFreq = samplingFreq | 0;

}

function instanceInit(dsp, samplingFreq) {
    dsp = dsp | 0;
    samplingFreq = samplingFreq | 0;
    var i0 = 0;
    HEAP32[dsp + 12 >> 2] = (samplingFreq | 0);
    HEAPF32[dsp + 8 >> 2] = +(0.);
    for (i0 = 0; (((i0 | 0) < 2) | 0); i0 = (((i0 | 0) + 1) | 0)) {
        HEAP32[dsp + 0 + ((i0 | 0) << 2) >> 2] = 0;

    }

}

function init(dsp, samplingFreq) {
    dsp = dsp | 0;
    samplingFreq = samplingFreq | 0;
    classInit(dsp, samplingFreq);
    instanceInit(dsp, samplingFreq);
}

function setValue(dsp, offset, value) {
    dsp = dsp | 0;
    offset = offset | 0;
    value = +value;
    HEAPF32[dsp + offset >> 2] = value;
}

function getValue(dsp, offset) {
    dsp = dsp | 0;
    offset = offset | 0;
    return +HEAPF32[dsp + offset >> 2];
}

function compute(dsp, count, inputs, outputs) {
    dsp = dsp | 0;
    count = count | 0;
    inputs = inputs | 0;
    outputs = outputs | 0;
    var output0 = 0;
    var fSlow0 = 0.;
    var i = 0;
    output0 = (HEAP32[outputs + (0 << 2) >> 2] | 0);
    fSlow0 = +(4.65661e-10 * +(+(HEAPF32[dsp + 8 >> 2])));
    for (i = 0; (((i | 0) < (count | 0)) | 0); i = (((i | 0) + 1) | 0)) {
        HEAP32[dsp + 0 + (0 << 2) >> 2] = ((12345 + (imul(1103515245, (HEAP32[dsp + 0 + (1 << 2) >> 2] | 0)) | 0)) | 0);
        HEAPF32[output0 + ((i | 0) << 2) >> 2] = +(+(+(fSlow0) * +((HEAP32[dsp + 0 + (0 << 2) >> 2] | 0))));
        HEAP32[dsp + 0 + (1 << 2) >> 2] = (HEAP32[dsp + 0 + (0 << 2) >> 2] | 0);

    }

}

return { getNumInputs : getNumInputs, getNumOutputs : getNumOutputs, classInit : classInit, instanceInit : instanceInit, init : init, setValue : setValue, getValue : getValue, compute : compute };

}

function getSizemydsp() {
return 16;
}

function getPathTablemydsp() {

var pathTable = [];
pathTable["/0x00/Volume"] = 8;
return pathTable;

}

function getJSONmydsp() {
return "{ "name": "Noise", "outputs": "1", "meta": [ { "author": "Grame" }, { "copyright": "(c)GRAME 2009" }, { "license": "BSD" }, { "name": "Noise" }, { "version": "1.1" } ], "ui": [ { "type": "vgroup", "label": "0x00", "items": [ { "type": "vslider", "label": "Volume", "address": "/0x00/Volume", "meta": [ { "style": "knob" } ], "init": "0", "min": "0", "max": "1", "step": "0.1" } ] } ] } ";
}

function metadatamydsp(m) {
m.declare("author", "Grame");
m.declare("copyright", "(c)GRAME 2009");
m.declare("license", "BSD");
m.declare("name", "Noise");
m.declare("version", "1.1");
}

Crash log is :

bt

  • thread build errors #1: tid = 0x303a, 0x00007fff83138866 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    • frame #0: 0x00007fff83138866 libsystem_kernel.dylib__pthread_kill + 10 frame #1: 0x00007fff8cdd835c libsystem_pthread.dylibpthread_kill + 92
      frame We need a proper build system #2: 0x00007fff858e3b1a libsystem_c.dylibabort + 125 frame #3: 0x000000010000f04f asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseAfterKeyword(cashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::Frag&, char_&, char const_) + 575
      frame Memory size from emcc #4: 0x000000010000e8df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElement(char*&, char const*) + 335 frame #5: 0x000000010000e481 asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElementOrStatement(char_&, char const_) + 577
      frame How to convert imported variables? #6: 0x000000010000e0df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseBlock(char*&, char const*, cashew::IString, cashew::IString) + 463 frame #7: 0x0000000100012eff asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseBracketedBlock(char_&) + 287
      frame Fix missing override warning. #8: 0x000000010001350a asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseFunction(char_&, char const_) + 922 frame #9: 0x000000010000e8df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElement(char_&, char const_) + 335
      frame Mysterious intermittent error #10: 0x000000010000e481 asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElementOrStatement(char_&, char const_) + 577 frame #11: 0x000000010000e0df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseBlock(char_&, char const_, cashew::IString, cashew::IString) + 463
      frame fix typo in readme #12: 0x0000000100012eff asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseBracketedBlock(char_&) + 287 frame #13: 0x000000010001350a asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseFunction(char*&, char const*) + 922
      frame Warning due to uninitialized value #14: 0x000000010000e8df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElement(char_&, char const_) + 335 frame #15: 0x000000010000e481 asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseElementOrStatement(char*&, char const*) + 577
      frame Spec test fail on unoptimized build #16: 0x000000010000e0df asm2wasmcashew::Parser<cashew::Ref, cashew::DotZeroValueBuilder>::parseBlock(char_&, char const_, cashew::IString, cashew::IString) + 463 frame #17: 0x000000010000485f asm2wasmmain + 463
      frame Sort the local variable order with the most frequently referenced first. #18: 0x00007fff8fcc15fd libdyld.dylib`start + 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions