Skip to content

Matrix multiplication crashes using mingw 4.7

Submitted by djurikom

Assigned to Nobody

Link to original bugzilla bug (#556)
Operating system: Windows

Description

The code compiles without any problems. However, when executed the program crashes in this function:

MatrixXd sqdist(MatrixXd A, MatrixXd B)

{

A.transposeInPlace();  

B.transposeInPlace();  

MatrixXd aa = (A.cwiseProduct(A)).colwise().sum();  

MatrixXd bb = (B.cwiseProduct(B)).colwise().sum();  

MatrixXd aSquare(aa.cols(), bb.cols());  

MatrixXd bSquare(aa.cols(), bb.cols());  

for (int i = 0; i < bb.cols(); i++)  

{  

	aSquare.col(i) = aa.transpose();  

}  

for (int i = 0; i < aa.cols(); i++)  

{  

	bSquare.row(i) = bb;  

}  

MatrixXd dist = aSquare + bSquare - 2.0 * A.transpose() * B;  

abs(dist);  

return dist;  

}

The function is supposed to find a distance matrix between rows in A and B. The program crashes at "2.0 * A.transpose() * B". It is interesting that it DOES NOT crash when I compile using

gcc -v

Using built-in specs.

Target: i686-w64-mingw32

Configured with: ../gcc44-svn/configure --target=i686-w64-mingw32 --host=i686-w6

4-mingw32 --disable-multilib --disable-nls --disable-win32-registry --prefix=/mi

ngw32 --with-gmp=/mingw32 --with-mpfr=/mingw32 --enable-languages=c,c++

Thread model: win32

gcc version 4.4.3 (GCC)

while it DOES crash using

gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=c:/users/ny_name/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.

7.0/lto-wrapper.exe

Target: i686-pc-mingw32

Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/g

cc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-language

s=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-n

ls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-

checking=release --enable-lto

Thread model: win32

gcc version 4.7.0 (GCC)

I am compiling using:

g++ -Wall -Wconversion -O3

Blocking

#814 #387 (closed)