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 exp/17648] New: segfault calling function returning object with multiple ctors


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

            Bug ID: 17648
           Summary: segfault calling function returning object with
                    multiple ctors
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
          Assignee: unassigned at sourceware dot org
          Reporter: skobes at google dot com

I have the following program:

// wtf.cc
struct A { };
struct B {
  B() : f(0) { }
  B(A a) : f(0) { }
  int f;
};
B crash() { return B(); }
int main(int argc, char** argv) { }


I compile it and start gdb:

$ g++ -O0 -g -c wtf.cc -o wtf.o
$ g++ -o wtf wtf.o
$ gdb --args wtf


Inside gdb I run:

(gdb) break main
Breakpoint 1 at 0x400511: file wtf.cc, line 9.
(gdb) run
Starting program: /tmp/gdbcrash/wtf 

Breakpoint 1, main (argc=1, argv=0x7fffffffdd38) at wtf.cc:9
9    int main(int argc, char** argv) { }
(gdb) p crash()
Segmentation fault (core dumped)

-- 
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]