https://bugs.kde.org/show_bug.cgi?id=487993
            Bug ID: 487993
           Summary: Alignment error when using Eigen with Valgrind and
                    -m32
    Classification: Developer tools
           Product: valgrind
           Version: 3.21.0
          Platform: RedHat Enterprise Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: joebobrocks123456...@gmail.com
  Target Milestone: ---

The following c++ code fails with misaligned assertion only when using
valgrind:
```
#include "eigen-3.4.0/Eigen/Geometry"
#include <iostream>

int main(int argc, char** argv) {
    Eigen::Affine3d* test;

    test = new Eigen::Affine3d();

    std::cout << test << std::endl;

    delete test;

    return 0;
}
```

When compiled and run normally with `g++ main.cpp -m32 -std=c++17`, the code
runs properly and prints the address of `test`. When run with valgrind,
however, we get `a.out: eigen-3.4.0/Eigen/src/Core/DenseStorage.h:109:
Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 16>::plain_array()
[with T = double; int Size = 16; int MatrixOrArrayOptions = 0]: Assertion
`(internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) &
(15)) == 0 && "this assertion is explained here: "
"http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html"; "
**** READ THIS WEB PAGE !!! ****"' failed.`.

Note that this only occurs with the `m32` flag set.

How to reproduce:

* Download Eigen 3.4.0 (https://gitlab.com/libeigen/eigen/-/releases/3.4.0) and
place in project root
* Copy the c++ code to `main.cpp`
* run `g++ main.cpp -m32 -std=c++17`
* run `./a.out` and confirm it succeeds
* run `valgrind ./a.out` and confirm it fails

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to