public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "Henrik Mannerström" <henrik.mannerstrom@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: std::string clobbers memory when compiling without optimizations
Date: Fri, 03 Oct 2014 12:36:00 -0000	[thread overview]
Message-ID: <CAH6eHdQWTr85CpbpGFeFahg+h7cT8QZmcGjirJ3XoFhtWYHO=Q@mail.gmail.com> (raw)
In-Reply-To: <542E7AE1.2090807@gmail.com>

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.

  reply	other threads:[~2014-10-03 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03  8:19 Henrik Mannerström
2014-10-03  9:58 ` Jonathan Wakely
2014-10-03 10:09   ` Henrik Mannerström
2014-10-03 10:20     ` Jonathan Wakely
2014-10-03 10:31       ` Henrik Mannerström
2014-10-03 12:36         ` Jonathan Wakely [this message]
2014-10-03 10:31       ` Marc Glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdQWTr85CpbpGFeFahg+h7cT8QZmcGjirJ3XoFhtWYHO=Q@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=henrik.mannerstrom@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).