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

Bug 1432

Summary: Bypass memcpy for unsuitable scalar types (aka make a better use of C++11 type-traits)
Product: Eigen Reporter: Gael Guennebaud <gael.guennebaud>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Crash CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 558    

Description Gael Guennebaud 2017-06-06 08:49:33 UTC
See:

basically some types like std::string might not be copiable by memcpy if too short. The proposed fix is to use c++11 type-traits to detect this and bypass memcpy (in Memory.h) in such cases. In c++98, we would document it a known pitfall.

In the same vein, NumTraits::RequireInitialization currently default to:

RequireInitialization = internal::is_arithmetic<T>::value ? 0 : 1

whereas c++11 provides more accurate type-traits for that.
Comment 1 Gael Guennebaud 2017-06-06 08:50:24 UTC
oops, the missing link is: https://forum.kde.org/viewtopic.php?f=74&t=140169
Comment 2 Gael Guennebaud 2018-07-18 21:35:33 UTC
https://bitbucket.org/eigen/eigen/commits/ce3a50205919/
Summary:     Bug 1432: fix conservativeResize for non-relocatable scalar types. For those we need to by-pass realloc routines and fall-back to allocate as new - copy - delete. The remaining problem is that we don't have any mechanism to accurately determine whether a type is relocatable or not, so currently let's be super conservative using either RequireInitialization or std::is_trivially_copyable
Comment 3 Nobody 2019-12-04 17:01:17 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/1432.