Bug#820855: crashes when compiled with -D_GLIBCXX_DEBUG

Erik Thiele erik.thiele at thiele-hydraulik.de
Wed Apr 13 07:27:19 UTC 2016


Package: libsigc++-2.0-0c2a
Version: 2.2.10-0.2

erik at host:~/sigcpp_bug$ cat bug.cpp
#include <sigc++/sigc++.h>
#include <iostream>

using namespace std;
using namespace sigc;

class sigtester : public sigc::trackable {
public:
  sigtester();
  void myslot();
  signal0<void> mysig;
};

sigtester::sigtester()
{ cout << "sigtester::sigtester\n"; }

void sigtester::myslot()
{ cout << "sigtester::myslot\n"; }

void globalSlot()
{ cout << "globalSlot\n"; }

int main(int, char *[])
{
  sigtester st;
  cout << "first test starts\n";
  st.mysig.connect(sigc::mem_fun(&st, &sigtester::myslot));
  cout << "first test passed\n";

  signal0<void> thesig;
  cout << "second test starts\n";
  thesig.connect(sigc::ptr_fun(&globalSlot));
  cout << "second test passed\n";

  return 0;
}

erik at host:~/sigcpp_bug$: g++ -g -Wall -Werror -D_GLIBCXX_DEBUG \
  $(pkg-config --cflags sigc++-2.0) \
  $(pkg-config --libs sigc++-2.0) bug.cpp -o will_crash

erik at host:~/sigcpp_bug$ g++ -g -Wall -Werror \
  $(pkg-config --cflags sigc++-2.0) \
  $(pkg-config --libs sigc++-2.0) bug.cpp -o will_work

erik at host:~/sigcpp_bug$ ./will_work 
sigtester::sigtester
first test starts
first test passed
second test starts
second test passed
erik at host:~/sigcpp_bug$ ./will_crash 
sigtester::sigtester
first test starts
Segmentation fault

erik at host:~/sigcpp_bug$ gdb ./will_crash 
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/global/erik/sigcpp_bug/will_crash...done.
(gdb) run
Starting program: /home/global/erik/sigcpp_bug/will_crash 
sigtester::sigtester
first test starts

Program received signal SIGSEGV, Segmentation fault.
0xb7f723bd in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0xb7f723bd in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#1  0xb7f7246a in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#2  0xb7f7267c in __gnu_debug::_Safe_iterator_base::_M_detach() ()
from /usr/lib/i386-linux-gnu/libstdc++.so.6 #3  0x0804937b in
__gnu_debug::_Safe_iterator_base::~_Safe_iterator_base
(this=0xbffff66c, __in_chrg=<optimized out>)
at /usr/include/c++/4.7/debug/safe_base.h:105 #4  0x08049489 in
__gnu_debug::_Safe_iterator<std::__cxx1998::_List_iterator<sigc::slot_base>,
std::__debug::list<sigc::slot_base, std::allocator<sigc::slot_base> >
>::~_Safe_iterator (this=0xbffff66c, __in_chrg=<optimized out>)
>at /usr/include/c++/4.7/debug/safe_iterator.h:118 #5  0x080496d6 in
>sigc::signal0<void, sigc::nil>::connect (this=0xbffff6ac, slot_=...)
>at /usr/include/sigc++-2.0/sigc++/signal.h:2661 #6  0x08049091 in main
>() at bug.cpp:33 (gdb) 

this bug can also be reproduced on package version 2.4.0-1 on debian
jessie.

The problem is, that because of the bug I cannot use _GLIBCXX_DEBUG for
a large project where even only a small part of it uses libsigc++.

Also I am not sure if the problem is libsigc++ or the debugging feature
of libc.


cya
erik



More information about the pkg-gnome-maintainers mailing list