This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/18157] New: Segfault when debugging a program where an initializer list contains a lambda function with auto variables


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]