My compiled program crashes when it receives many SIGNALs 19 from outside. It
also crashes when another signal is used, if the 'disposition f(int)' is set on
it.

Sun Solaris 8 on intel 2*CPU Pentium III Xeon.
GCC is from the sunfreeware.com bundle.

I tries it on the "Sun Solaris 8 on 1*CPU UltraSparc IIi" and on the "Sun
Solaris 8 on <many CPUs>*CPU UltraSparc III". It does NOT crash on these
systems.

The program is:
--------------------
#include <signal.h>
#include <vector>

void f(int)
{
}

int main(int argc, char* argv[])
{
   typedef std::vector<int> V;

   ::sigset(19, f);

   while ( true ) {
      V *v1 = new V();

      for(int n=0; n<1000; n++)
         v1->push_back(n);

      V *v2 = new V(*v1);

      delete v1;
      delete v2;
   }
}
--------------------

I compile it this way:
--------------------
[EMAIL PROTECTED]:/home/barsuk/src/gcc-bug>g++ -v -save-temps test.cpp
Reading specs from /usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nl
Thread model: posix
gcc version 3.4.2
 /usr/local/libexec/gcc/i386-pc-solaris2.8/3.4.2/cc1plus -E -quiet -v test.cpp
-o test.ii
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/../../../../i386-pc-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/../../../../include/c++/3.4.2

/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/../../../../include/c++/3.4.2/i386-pc-solaris2.8

/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/../../../../include/c++/3.4.2/backward
 /usr/local/include
 /usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/include
 /usr/include
End of search list.
 /usr/local/libexec/gcc/i386-pc-solaris2.8/3.4.2/cc1plus -fpreprocessed test.ii
-quiet -dumpbase test.cpp -auxbase test -version -o test.s
GNU C++ version 3.4.2 (i386-pc-solaris2.8)
        compiled by GNU C version 3.4.2.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65485
 /usr/ccs/bin/as -V -Qy -s -o test.o test.s
as: Sun WorkShop 6 99/08/16
 /usr/local/libexec/gcc/i386-pc-solaris2.8/3.4.2/collect2 -V -Y
P,/usr/ccs/lib:/usr/lib -Qy /usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/crt1.o
/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/crti.o /usr/ccs/lib/values-Xa.o
/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/crtbegin.o
-L/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2 -L/usr/ccs/bin -L/usr/ccs/lib
-L/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/../../.. test.o -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/crtend.o
/usr/local/lib/gcc/i386-pc-solaris2.8/3.4.2/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.299
--------------------

That I run the program:
--------------------
./a.out
--------------------

In the next terminal window I run the script:
--------------------
while true ; do pkill -19 a.out ; done
--------------------

The program a.out crashes:
--------------------
Segmentation Fault(coredump)
--------------------

I run gdb:
--------------------
[EMAIL PROTECTED]:/home/barsuk/src/gcc-bug>gdb a.out core
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.8"...(no debugging symbols found)

Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/lib/libstdc++.so.6...done.
Loaded symbols for /usr/local/lib/libstdc++.so.6
Reading symbols from /usr/lib/libm.so.1...done.
Loaded symbols for /usr/lib/libm.so.1
Reading symbols from /usr/local/lib/libgcc_s.so.1...done.
Loaded symbols for /usr/local/lib/libgcc_s.so.1
Reading symbols from /usr/lib/libc.so.1...done.
Loaded symbols for /usr/lib/libc.so.1
Reading symbols from /usr/lib/libdl.so.1...done.
Loaded symbols for /usr/lib/libdl.so.1
#0  0x08052696 in std::_Destroy<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > > > ()
(gdb) bt
#0  0x08052696 in std::_Destroy<__gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > > > ()
#1  0x08052336 in std::vector<int, std::allocator<int> >::_M_insert_aux ()
#2  0x08051edf in std::vector<int, std::allocator<int> >::push_back ()
#3  0x08051d51 in main ()
(gdb) 
--------------------

I suggest the problem is in STL, when the memory copy routine is interrupted by
the signal. May be somewhere in STL the value on errno, when it equals EINTR,
is not handled correctly.


-- 
           Summary: Compiled program crashes when it gets SIGNAL 19 many
                    times.
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ademin at gmail dot com
 GCC build triplet: g++ -v -save-temps test.cpp
  GCC host triplet: Sun Solaris 8 on intel 2*CPU Pentium III Xeon
GCC target triplet: GCC 3.4.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27223

Reply via email to