From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21330 invoked by alias); 3 Oct 2014 10:31:09 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 21321 invoked by uid 89); 3 Oct 2014 10:31:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f42.google.com Received: from mail-la0-f42.google.com (HELO mail-la0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 03 Oct 2014 10:31:07 +0000 Received: by mail-la0-f42.google.com with SMTP id mk6so784334lab.15 for ; Fri, 03 Oct 2014 03:31:04 -0700 (PDT) X-Received: by 10.112.155.230 with SMTP id vz6mr2239538lbb.99.1412332264208; Fri, 03 Oct 2014 03:31:04 -0700 (PDT) Received: from [130.233.179.5] ([130.233.179.5]) by mx.google.com with ESMTPSA id am8sm2538730lac.46.2014.10.03.03.31.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Oct 2014 03:31:03 -0700 (PDT) Message-ID: <542E7AE1.2090807@gmail.com> Date: Fri, 03 Oct 2014 10:31:00 -0000 From: =?UTF-8?B?SGVucmlrIE1hbm5lcnN0csO2bQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Jonathan Wakely CC: gcc-help Subject: Re: std::string clobbers memory when compiling without optimizations References: <542E5BF1.2070508@gmail.com> <542E75B9.9010504@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00016.txt.bz2 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