[eigen] Map alignedStart issue

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


Hi all,

I get a strange bug in my application that I cannot reproduce in a small test case.

Somewhere in my code I have:

void myfunction(double* pattern)
{
Map<ArrayXd> pVec(pattern,12);
pVec.setZero();

// ...
}

The problem is that when SSE2 is enabled, I get a segfault on the setZero() call. (If I don't activate sse2, no problems). The double* pattern pointer is NOT necessarily aligned. Please find the backtrace at the end of this message.

The problem seems that Eigen start finding the first aligned index where to start vectorization, and it get -1075572760. Accessing this index causes the segfault.

As I said, I cannot reproduce this bug in a small test case, so it may comes from a mistake in my code, but I have no idea where to look at.

If I avoid the setZero call with a basic for loop, the same kind of problem appear later in a pVec.sum() call.

I'm using the last version of eigen in the development branch, gcc 4.3.2 on debian with -msse2 -mstackrealign flags.

Is anybody have an idea of what happen ? or where to look ?
Any help is appreciated.

++
Benoit

----------------------------
(gdb) bt
#0  0xb53869a0 in Eigen::internal::pstore<double, double __vector> (
    to=0x8c52df0, from=@0xbfe40df0)
    at /usr/lib/gcc/i486-linux-gnu/4.3.2/include/emmintrin.h:150
#1  0xb5387706 in Eigen::internal::pstoret<double, double __vector, 1> (
    to=0x8c52df0, from=@0xbfe40df0)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/GenericPacketMath.h:280 #2 0xb538d140 in Eigen::MapBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, 1>::writePacket<1> (this=0xbfe40fe8,
    index=-1075572760, x=@0xbfe40df0)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/MapBase.h:235 #3 0xb539f0a5 in Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, 1>::copyPacket<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, 1, 0> (this=0xbfe40fe8,
    index=-1075572760, other=@0xbfe40f38)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/DenseCoeffsBase.h:541 #4 0xb539f169 in Eigen::internal::assign_impl<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, 3, 0>::run (dst=@0xbfe40fe8, src=@0xbfe40f38) at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:422 #5 0xb539f25a in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::lazyAssign<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > > > (this=0xbfe40fe8, other=@0xbfe40f38) at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:511 #6 0xb539f2cc in Eigen::internal::assign_selector<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, false, false>::run (dst=@0xbfe40fe8,
    other=@0xbfe40f38)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:534 #7 0xb539f31c in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::operator=<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > > > (this=0xbfe40fe8, other=@0xbfe40f38) at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/Assign.h:555 #8 0xb539f397 in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::setConstant (this=0xbfe40fe8,
    value=@0xbfe40f88)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h:341 #9 0xb539f3d7 in Eigen::DenseBase<Eigen::Map<Eigen::Array<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::setZero (this=0x8c52df0) at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h:490
#10 0xb5399c8a in YAAFE_EXT::Chroma2ChordDict::Dict::fillPattern (
    this=0x9a44250, notes=@0x9a4c310, nbHarmo=1, pattern=0x9a4aeb0)
at /amd/asansol.enst.fr/home/bmathieu/data/workspace/yaafe-extension/tp-yaafe-extension/components/Chroma2ChordDict.cpp:96




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