Re: [eigen] Bug report on Tensor

[ Thread Index | Date Index | More Archives ]

Thank you.
That was it, now it runs !


On Thu, Jan 28, 2016 at 2:12 AM, Benoit Steiner <> wrote:
The assertion that caused the crash is in fact unnecessary. I deleted it and added a test to make sure that you can you the assignment operator on empty tensors. Let me know if the fix works for you, its available in commit

On Wed, Jan 27, 2016 at 11:51 AM, Mathieu Dutour <mathieu.dutour@xxxxxxxxx> wrote:
Hi all,

I had a problem with the Eigen::Tensor<double,3>.
The segmentation fault happens exactly when I am
moving data from one function to another.

That is I have a
struct RecVar {
   ... some double
   ... some std::string
   ... some int
   ... some Eigen::Matrix
  Eigen::Tensor<double,3> Tens3;

When returning the value, we have Tens3 which is unset.
Error that happens is
MERGE_field: /home/mathieu/opt/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:108: void Eigen::Tensor\
Storage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::resize(Eigen::TensorStorage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::Index, Eigen::array<IndexType, NumIndices_>&) [with T = double; int Options_ = 0; IndexType = long int; int NumIndices_ = 3; Eigen::TensorStorage<T, Eigen::DSizes<IndexType, NumIndices_>, Options_>::Index = long int; Eigen::array<IndexType, NumIndices_> = std::array<long int, 3ul>]: Assertion `size >= 1' failed.

The backtrack with gdb gives me the error as
#0  0x00000038eb232625 in raise () from /lib64/
#1  0x00000038eb233e05 in abort () from /lib64/
#2  0x00000038eb22b74e in __assert_fail_base () from /lib64/
#3  0x00000038eb22b810 in __assert_fail () from /lib64/
#4  0x000000000046841e in Eigen::Tensor<double, 3, 0, long>::operator=(Eigen::Tensor<double, 3, 0, long> const&) () at /home/mathieu/opt/eigen/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:108
#5  0x0000000000468605 in RecVar::operator=(RecVar&&) () at Basic_Ocean_types.h:12

So, it seems a move operator makes assumptions which are not correct,
though I am not sure. The move operator is the one provided by the compiler
to RecVar which is a POD.

All hints on how to solve it would be appreciated. In particular I am interested
in writing some operator /= for the tensor class just like we have for the matrix

Error happens with gcc 5.1.0 and with gcc 5.3.0. I know it is unsupported,
still any help would be much appreciated.



Mail converted by MHonArc 2.6.19+