Re: [eigen] [BUG?] DiagonalWrapper * SparseMatrix with -DNDEBUG *and* optimization dumps core

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


That seems to be the same as this bug:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=942
I have no idea, what exactly goes wrong there ...

Regarding bugzilla account, can you try again, and if it does not work, ask in irc how to proceed?

Christoph

Am 15.04.2015 um 18:59 schrieb Jan van Dijk:
NOTE: I tried to file the issue below as a (potential) Eigen bug in Bugzilla,
but I never received the promised confirmation mail for my registration.
More Bugzilla problems still?

   Dear friends,

With today's trunk version of Eigen, it appears that left-multiplication of a
ColMajor sparse matrix and right-multiplication of a RowMajor sparse
matrix with a DiagonalWrapper fail. On gcc-4.8.3 I get a segmentation
fault or a bus error  when passing -DNDEBUG  *AND* -O[1,2} is used.
Otherwise, everything works fine

I reduced this to the code below. (I apologize if i mis-understand Eigen
and that code is in error. I am an Eigen-novice still...)

   Regards, Jan.

// sparse_test.cpp:
#include "Eigen/Core"
#include "Eigen/Sparse"
#include <iostream>

typedef double value_type;
typedef Eigen::Matrix<value_type, Eigen::Dynamic, 1> vector_type;
typedef Eigen::SparseMatrix<value_type, Eigen::ColMajor> cm_matrix_type;
typedef Eigen::SparseMatrix<value_type, Eigen::RowMajor> rm_matrix_type;

int main()
{
         cm_matrix_type cmA(1,1);
         cmA.insert(0,0) = 1;

         rm_matrix_type rmA(1,1);
         rmA.insert(0,0) = 1;

         vector_type d(1);
         d[0] = 2;

         // OK:
         std::cout << ( cmA*d.asDiagonal() ).eval();
         std::cout << ( d.asDiagonal()*rmA ).eval();

         // with gcc-4.8.3:
         // - Bus error or segmentation fault with -DNDEBUG and -O{1,2}
         std::cout << ( rmA*d.asDiagonal() ).eval();
         std::cout << ( d.asDiagonal()*cmA ).eval();

         return 0;
}

jan@gum15: gcc --version
gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]

jan@gum15:  g++ -DNDEBUG -O2 -I /home/jan/local/eigen/include/eigen3
sparse_test.cpp && ./a.out
2
2
Segmentation fault (core dumped)

(Omit -DNDEBUG *or* -O2 and everything works like a charm.)





--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/