Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • eigen eigen
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 653
    • Issues 653
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Custom issue tracker
    • Custom issue tracker
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • libeigen
  • eigeneigen
  • Issues
  • #1049
Closed
Open
Created Dec 04, 2019 by Eigen Bugzilla@eigenbzReporter

std::make_shared fails to fulfill structure aliment

Submitted by Valentin Roussellet

Assigned to Nobody

Link to original bugzilla bug (#1049)
Version: 3.2
Platform: x86 - 32-bit

Description

As described in the doc, structures having Eigen aligned members (e.g. Vector4) may be misaligned when created on the heap with new.

http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html

The solution for that issue is to overload the operator new, which is provided as a convenience macro to add in the said struct.

However std::make_shared ignores the overladed operator new as, in at least two implementations of the STD (GNU and MSCV) actually calls the global ::new.

These two codes, while semantically equivalent, behave differently.

std::shared_ptr<Foo> = std:::make_shared<Foo>(...)
std::shared_ptr<Foo> = std:::shared_ptr<Foo>(new Foo(...))

The second one yielding correct alignment while the first one may return a non-aligned pointer.

Would another macro specializing std::make_shared for all types requiring alignment be useful or practical ?

If not, should Eigen provide a make_aligned_shared<T> implementation ?

Blocking

#814 (closed)

Edited Dec 05, 2019 by Eigen Bugzilla
Assignee
Assign to
Time tracking