std::string clobbers memory when compiling without optimizations

Henrik Mannerström henrik.mannerstrom@gmail.com
Fri Oct 3 10:31:00 GMT 2014


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?

Thank you for you time.

- Henrik



More information about the Gcc-help mailing list