std::string clobbers memory when compiling without optimizations

Jonathan Wakely jwakely.gcc@gmail.com
Fri Oct 3 12:36:00 GMT 2014


On 3 October 2014 11:30, Henrik Mannerström wrote:
> On 10/03/2014 01:20 PM, Jonathan Wakely wrote:
>> My guess is that Sigma holds a dangling reference to some temporary
>> object that has gone out of scope, and the function call t2s
>> overwrites that stack memory, then when you return to main you go
>> through the dangling reference.
>>
>> Are you sure you're using the Eigen types correctly?
> You are right, the auto type does not force the evaluation of Sigma,
> which leaves the dangling reference. Yet again I get burned by trying to
> combine Eigen and C++11. How would you classify this, could you call it
> a bug in Eigen, or just incompatibility with C++11?

As Marc says, expression templates are often incompatible with 'auto',
that doesn't mean Eigen is incompatible with C++11 in general.



More information about the Gcc-help mailing list