public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sourceware at optimojoe dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/18157] New: Segfault when debugging a program where an initializer list contains a lambda function with auto variables
Date: Tue, 24 Mar 2015 10:13:00 -0000	[thread overview]
Message-ID: <bug-18157-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=18157

            Bug ID: 18157
           Summary: Segfault when debugging a program where an initializer
                    list contains a lambda function with auto variables
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: sourceware at optimojoe dot com

The following program:

------
#include <functional>

struct Foo {
    std::function <void(double &)> f;
    Foo (
        std::function <void(double &)> const & f_ 
    ) : f(f_) {}
};

struct Bar {
    Foo foo;
    Bar() :
        foo([](auto & num) {})
    {}
};

int main() {
    Bar bar;
}
------

segfaults gdb on startup:

$ gdb test19
GNU gdb (Gentoo 7.7.1 p1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test19...Segmentation fault

However, when changing the line

        foo([](auto & num) {})

to

        foo([](double & num) {})

gdb works as normal.  In case it helps:

GNU gdb (Gentoo 7.7.1 p1) 7.7.1
gcc version 4.9.2 (Gentoo 4.9.2 p1.0, pie-0.6.1)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2015-03-24  9:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 10:13 sourceware at optimojoe dot com [this message]
2015-03-25 10:01 ` [Bug c++/18157] " keiths at redhat dot com

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=bug-18157-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).