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
When you run the function ToMatrix twice, it gives memory access error, makes no sense.
I simplified the bug as much as possible, to reproduce it just use the following. https://wasdk.github.io/WasmFiddle/
###############C++14###############
#include <math.h>
void ToMatrix(double** M,double* V,int length)
{
for (int i = 0; i < length; i++)
{
for (int j = 0; j < length; j++)
{
M[i][j] = V[i * length + j];
}
}
}
void myfunc(double* AT, int length)
{
double** Matrix = new double* [length];
for (int i = 0; i < length; i++)
{
Matrix[i] = new double[length];
}
ToMatrix(Matrix,AT,length);
////Error comes when you do it twice
ToMatrix(Matrix,AT,length);
///
}
###############Javascript###############
var wasmModule = new WebAssembly.Module(wasmCode);
wasmInstance = new WebAssembly.Instance(wasmModule, wasmImports);
matrix1 = [[12,-51,4],[6,167,-68],[-4,24,-41]]
InputArray = new Float64Array(wasmInstance.exports.memory.buffer,0,9)
for (var i = 0; i < 3; i++)
{
for (var j = 0; j < 3; j++)
{
InputArray[3*i+j] = matrix1[i][j]
}
}
log(InputArray)
wasmInstance.exports._Z6myfuncPdi(0,3);
The text was updated successfully, but these errors were encountered:
When you run the function ToMatrix twice, it gives memory access error, makes no sense.
I simplified the bug as much as possible, to reproduce it just use the following.
https://wasdk.github.io/WasmFiddle/
The text was updated successfully, but these errors were encountered: