This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1758

Summary: ei_declare_aligned_stack_constructed_variable ignores alignment requirement of custom types
Product: Eigen Reporter: Christoph Hertzberg <chtz>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: CONFIRMED ---    
Severity: Crash CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Lowest Keywords: test-needed
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 1608    

Description Christoph Hertzberg 2019-10-14 12:31:58 UTC
As found on this SO post:
https://stackoverflow.com/questions/58366939/eigen3-boost-mpfr-segfault-when-alignment-is-disabled

Eigen fails to work with MPFR if compiled with `-DEIGEN_MAX_ALIGN_BYTES=0`.
The reason appears to be that the specific type used in the example requires 16 byte alignment, which however is ignored by `ei_declare_aligned_stack_constructed_variable`.

Similar issues likely arise for custom types which require more than the standard alignment.
Comment 1 Gael Guennebaud 2019-10-14 20:24:59 UTC
Do we re
Comment 2 Gael Guennebaud 2019-10-14 20:28:38 UTC
Do we really want to fix that one? I mean compiling with `-DEIGEN_MAX_ALIGN_BYTES=0` while using a scalar type requiring over-alignment at the same time does not looks right to me. I'm not against a fix, but I see it as low priority.
Comment 3 Christoph Hertzberg 2019-10-15 09:48:47 UTC
Ok, good point. We could statically assert, if someone tries to use an over-aligned type. But that requires some code to make sure that PODs don't break (e.g., alignof(double)==8 on many platforms).

--> Changed to blocking 3.x

Also, we don't really have a good mechanism to individually set the alignment of types (and I don't see good solutions without breaking the API ...)
Comment 4 Nobody 2019-12-04 18:50:07 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1758.