From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31099 invoked by alias); 29 Nov 2012 20:04:12 -0000 Received: (qmail 30989 invoked by uid 48); 29 Nov 2012 20:03:49 -0000 From: "matt at godbolt dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55532] Runtime segfault calling mutable lambda wrapped in a non-mutable lambda within a template function Date: Thu, 29 Nov 2012 20:04:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: matt at godbolt dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg02908.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55532 --- Comment #1 from Matt Godbolt 2012-11-29 20:03= :47 UTC --- I can reproduce this on GCC 4.8 (rev 185382], and g++ 4.6.3. Adding -O mak= es the issue go away (as the whole program is optimized to "return 0;"). =46rom the assembler dump the segv appears to happen when the compiler is generating a "this" pointer for the inner lambda: void oops(Foo&, int const&)::{lambda()#1}::_FUN(): pushq %rbp movq %rsp, %rbp >>> movl $0, %edi call void oops(Foo&, int const&)::{lambda()#1}::operator()() popq %rbp ret [this output can also be seen at http://url.godbolt.org/mdjvf ]