This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

SIGSEGV occurring when code compiled with gcc with multithreaded code.


I get a SIGSEGV violation when executing the following multithreaded code
after two to three minutes. I get this problem when I compile the code with
gcc. If I use the Sun compiler I do not get a SIGSEGV and the code executes
correctly.

I would really appreciate any help.

GCC VERSION:
gcc -v
Reading specs from
/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)

SYSTEM TYPE:
SunOS  5.7 Generic_106541-06 sun4u sparc SUNW,Ultra-250

OPTIONS PASSED TO THE COMPILER:

g++ -c  -D_SOLARIS -DHAVE_CONFIG_H -D_REENTRANT -I. -I.. -g -O2 -Wall -Werro
r msgTest2.C

COMPILER OUTPUT:

g++ -c -D_SOLARIS -DHAVE_CONFIG_H -D_REENTRANT -I. -I.. -g -O2 -Wall -Werror
 -v --save-temps msgTest2.C
Reading specs from
/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/specs
gcc version 2.95.2 19991024 (release)

/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cpp -lang-c++ 
-v -I. -I.. -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsp
arc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__sv
r4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__E
XCEPTIONS -D__OPTIMIZE__ -g -Wall -Werror -D__GCC_NEW_VARARGS__ -Acpu(sparc)
 -Amachine(sparc) -D_SOLARIS -DHAVE_CONFIG_H -D_REENTRANT msgTest2.C
msgTest2.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 .
 ..

/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../in
clude/g++-3
 /usr/local/gcc-2.95.2/include

/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../sp
arc-sun-solaris2.7/include
 /usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/cc1plus
msgTest2.ii -quiet -dumpbase msgTest2.cc -g -O2 -Wall -Werror -version -o
msgTest2.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.7) compiled by
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
 /usr/ccs/bin/as -V -Qy -s -o msgTest2.o msgTest2.s
/usr/ccs/bin/as: WorkShop Compilers 5.0 98/12/21

SYSTEM RESOURCES:

limit
cputime         unlimited
filesize        unlimited
datasize        unlimited
stacksize       8192 kbytes
coredumpsize    0 kbytes
vmemoryuse      262144 kbytes
descriptors     64

PREPROCESSED OUTPUT:

See attachment file.

THE DEBUGGER OUTPUT:

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP    3        ]

Program received signal SIGSEGV, Segmentation fault.
0xfefc60e8 in t_splay ()
(gdb) where
#0  0xfefc60e8 in t_splay ()
#1  0xfefc5f58 in t_delete ()
#2  0xfefc5688 in _malloc_unlocked ()
#3  0xfefc550c in malloc ()
#4  0x12728 in _Deque_base<char *, allocator<char *>, 0>::_M_create_nodes (
    this=0xfe705bd0, __nstart=0x34efc, __nfinish=0x34f00)
    at
/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../in
clude/g++-3/stl_alloc.h:406
#5  0x128a0 in _Deque_base<char *, allocator<char *>, 0>::_M_initialize_map
(
    this=0xfe705bd0, __num_elements=0)
    at
/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../in
clude/g++-3/stl_deque.h:442
#6  0x11b94 in OrlSerialStr::func1 (this=0xfe705c6c)
    at
/usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/../../../../in
clude/g++-3/stl_deque.h:349
#7  0x12028 in SendRxTest::processMsg (this=0x2b9a8) at msgTest2.C:105
#8  0x11fb4 in SendRxTest::run (this=0x2b9a8) at msgTest2.C:94
#9  0x11f44 in SendRxTest::start (srx=0x2b9a8) at msgTest2.C:79

(gdb) disassemble t_splay
Dump of assembler code for function t_splay:
0xfefc60d4 <t_splay>:   save  %sp, -96, %sp
0xfefc60d8 <t_splay+4>: ld  [ %i0 + 8 ], %o7
0xfefc60dc <t_splay+8>: cmp  %o7, 0
0xfefc60e0 <t_splay+12>:        be  0xfefc62b8 <t_splay+484>
0xfefc60e4 <t_splay+16>:        nop
0xfefc60e8 <t_splay+20>:        ld  [ %o7 + 0x10 ], %o1
0xfefc60ec <t_splay+24>:        ld  [ %o7 + 8 ], %o5
0xfefc60f0 <t_splay+28>:        cmp  %o1, %i0
0xfefc60f4 <t_splay+32>:        bne  0xfefc61dc <t_splay+264>
0xfefc60f8 <t_splay+36>:        cmp  %o5, 0
0xfefc60fc <t_splay+40>:        be,a   0xfefc6188 <t_splay+180>
0xfefc6100 <t_splay+44>:        ld  [ %i0 + 0x18 ], %o0
0xfefc6104 <t_splay+48>:        ld  [ %o5 + 0x10 ], %o0
0xfefc6108 <t_splay+52>:        cmp  %o0, %o7
0xfefc610c <t_splay+56>:        bne,a   0xfefc6188 <t_splay+180>
0xfefc6110 <t_splay+60>:        ld  [ %i0 + 0x18 ], %o0
0xfefc6114 <t_splay+64>:        ld  [ %o7 + 0x18 ], %o0
0xfefc6118 <t_splay+68>:        st  %o0, [ %o5 + 0x10 ]
0xfefc611c <t_splay+72>:        cmp  %o0, 0
0xfefc6120 <t_splay+76>:        bne,a   0xfefc6128 <t_splay+84>
0xfefc6124 <t_splay+80>:        st  %o5, [ %o0 + 8 ]
0xfefc6128 <t_splay+84>:        ld  [ %i0 + 0x18 ], %o0
0xfefc612c <t_splay+88>:        st  %o0, [ %o7 + 0x10 ]
0xfefc6130 <t_splay+92>:        cmp  %o0, 0
0xfefc6134 <t_splay+96>:        bne,a   0xfefc613c <t_splay+104>
0xfefc6138 <t_splay+100>:       st  %o7, [ %o0 + 8 ]
0xfefc613c <t_splay+104>:       ld  [ %o5 + 8 ], %o1
0xfefc6140 <t_splay+108>:       st  %o1, [ %i0 + 8 ]
0xfefc6144 <t_splay+112>:       cmp  %o1, 0
0xfefc6148 <t_splay+116>:       be,a   0xfefc6174 <t_splay+160>
0xfefc614c <t_splay+120>:       st  %o7, [ %i0 + 0x18 ]
0xfefc6150 <t_splay+124>:       ld  [ %o5 + 8 ], %o0
0xfefc6154 <t_splay+128>:       ld  [ %o0 + 0x10 ], %o0
0xfefc6158 <t_splay+132>:       cmp  %o0, %o5
0xfefc615c <t_splay+136>:       bne,a   0xfefc6170 <t_splay+156>
0xfefc6160 <t_splay+140>:       st  %i0, [ %o1 + 0x18 ]
0xfefc6164 <t_splay+144>:       st  %i0, [ %o1 + 0x10 ]
0xfefc6168 <t_splay+148>:       b  0xfefc6174 <t_splay+160>
0xfefc616c <t_splay+152>:       st  %o7, [ %i0 + 0x18 ]
0xfefc6170 <t_splay+156>:       st  %o7, [ %i0 + 0x18 ]
0xfefc6174 <t_splay+160>:       st  %i0, [ %o7 + 8 ]
0xfefc6178 <t_splay+164>:       st  %o5, [ %o7 + 0x18 ]
0xfefc617c <t_splay+168>:       st  %o7, [ %o5 + 8 ]
---Type <return> to continue, or q <return> to quit---
0xfefc6180 <t_splay+172>:       b  0xfefc60dc <t_splay+8>
0xfefc6184 <t_splay+176>:       ld  [ %i0 + 8 ], %o7
0xfefc6188 <t_splay+180>:       st  %o0, [ %o7 + 0x10 ]
0xfefc618c <t_splay+184>:       cmp  %o0, 0
0xfefc6190 <t_splay+188>:       bne,a   0xfefc6198 <t_splay+196>
0xfefc6194 <t_splay+192>:       st  %o7, [ %o0 + 8 ]
0xfefc6198 <t_splay+196>:       ld  [ %o7 + 8 ], %o1
0xfefc619c <t_splay+200>:       st  %o1, [ %i0 + 8 ]
0xfefc61a0 <t_splay+204>:       cmp  %o1, 0
0xfefc61a4 <t_splay+208>:       be,a   0xfefc61d0 <t_splay+252>
0xfefc61a8 <t_splay+212>:       st  %o7, [ %i0 + 0x18 ]
0xfefc61ac <t_splay+216>:       ld  [ %o7 + 8 ], %o0
0xfefc61b0 <t_splay+220>:       ld  [ %o0 + 0x10 ], %o0
0xfefc61b4 <t_splay+224>:       cmp  %o0, %o7
0xfefc61b8 <t_splay+228>:       bne,a   0xfefc61cc <t_splay+248>
0xfefc61bc <t_splay+232>:       st  %i0, [ %o1 + 0x18 ]
0xfefc61c0 <t_splay+236>:       st  %i0, [ %o1 + 0x10 ]
0xfefc61c4 <t_splay+240>:       b  0xfefc61d0 <t_splay+252>
0xfefc61c8 <t_splay+244>:       st  %o7, [ %i0 + 0x18 ]
0xfefc61cc <t_splay+248>:       st  %o7, [ %i0 + 0x18 ]
0xfefc61d0 <t_splay+252>:       st  %i0, [ %o7 + 8 ]
0xfefc61d4 <t_splay+256>:       b  0xfefc60dc <t_splay+8>
0xfefc61d8 <t_splay+260>:       ld  [ %i0 + 8 ], %o7
0xfefc61dc <t_splay+264>:       be,a   0xfefc6264 <t_splay+400>
0xfefc61e0 <t_splay+268>:       ld  [ %i0 + 0x10 ], %o0
0xfefc61e4 <t_splay+272>:       ld  [ %o5 + 0x18 ], %o0
0xfefc61e8 <t_splay+276>:       cmp  %o0, %o7
0xfefc61ec <t_splay+280>:       bne,a   0xfefc6264 <t_splay+400>
0xfefc61f0 <t_splay+284>:       ld  [ %i0 + 0x10 ], %o0
0xfefc61f4 <t_splay+288>:       cmp  %o1, 0
0xfefc61f8 <t_splay+292>:       st  %o1, [ %o5 + 0x18 ]
0xfefc61fc <t_splay+296>:       bne,a   0xfefc6204 <t_splay+304>
0xfefc6200 <t_splay+300>:       st  %o5, [ %o1 + 8 ]
0xfefc6204 <t_splay+304>:       ld  [ %i0 + 0x10 ], %o0
0xfefc6208 <t_splay+308>:       st  %o0, [ %o7 + 0x18 ]
0xfefc620c <t_splay+312>:       cmp  %o0, 0
0xfefc6210 <t_splay+316>:       bne,a   0xfefc6218 <t_splay+324>
0xfefc6214 <t_splay+320>:       st  %o7, [ %o0 + 8 ]
0xfefc6218 <t_splay+324>:       ld  [ %o5 + 8 ], %o1
0xfefc621c <t_splay+328>:       st  %o1, [ %i0 + 8 ]
0xfefc6220 <t_splay+332>:       cmp  %o1, 0
0xfefc6224 <t_splay+336>:       be,a   0xfefc6250 <t_splay+380>
0xfefc6228 <t_splay+340>:       st  %o7, [ %i0 + 0x10 ]
0xfefc622c <t_splay+344>:       ld  [ %o5 + 8 ], %o0
---Type <return> to continue, or q <return> to quit---
0xfefc6230 <t_splay+348>:       ld  [ %o0 + 0x10 ], %o0
0xfefc6234 <t_splay+352>:       cmp  %o0, %o5
0xfefc6238 <t_splay+356>:       bne,a   0xfefc624c <t_splay+376>
0xfefc623c <t_splay+360>:       st  %i0, [ %o1 + 0x18 ]
0xfefc6240 <t_splay+364>:       st  %i0, [ %o1 + 0x10 ]
0xfefc6244 <t_splay+368>:       b  0xfefc6250 <t_splay+380>
0xfefc6248 <t_splay+372>:       st  %o7, [ %i0 + 0x10 ]
0xfefc624c <t_splay+376>:       st  %o7, [ %i0 + 0x10 ]
0xfefc6250 <t_splay+380>:       st  %i0, [ %o7 + 8 ]
0xfefc6254 <t_splay+384>:       st  %o5, [ %o7 + 0x10 ]
0xfefc6258 <t_splay+388>:       st  %o7, [ %o5 + 8 ]
0xfefc625c <t_splay+392>:       b  0xfefc60dc <t_splay+8>
0xfefc6260 <t_splay+396>:       ld  [ %i0 + 8 ], %o7
0xfefc6264 <t_splay+400>:       st  %o0, [ %o7 + 0x18 ]
0xfefc6268 <t_splay+404>:       cmp  %o0, 0
0xfefc626c <t_splay+408>:       bne,a   0xfefc6274 <t_splay+416>
0xfefc6270 <t_splay+412>:       st  %o7, [ %o0 + 8 ]
0xfefc6274 <t_splay+416>:       ld  [ %o7 + 8 ], %o1
0xfefc6278 <t_splay+420>:       st  %o1, [ %i0 + 8 ]
0xfefc627c <t_splay+424>:       cmp  %o1, 0
0xfefc6280 <t_splay+428>:       be,a   0xfefc62ac <t_splay+472>
0xfefc6284 <t_splay+432>:       st  %o7, [ %i0 + 0x10 ]
0xfefc6288 <t_splay+436>:       ld  [ %o7 + 8 ], %o0
0xfefc628c <t_splay+440>:       ld  [ %o0 + 0x10 ], %o0
0xfefc6290 <t_splay+444>:       cmp  %o0, %o7
0xfefc6294 <t_splay+448>:       bne,a   0xfefc62a8 <t_splay+468>
0xfefc6298 <t_splay+452>:       st  %i0, [ %o1 + 0x18 ]
0xfefc629c <t_splay+456>:       st  %i0, [ %o1 + 0x10 ]
0xfefc62a0 <t_splay+460>:       b  0xfefc62ac <t_splay+472>
0xfefc62a4 <t_splay+464>:       st  %o7, [ %i0 + 0x10 ]
0xfefc62a8 <t_splay+468>:       st  %o7, [ %i0 + 0x10 ]
0xfefc62ac <t_splay+472>:       st  %i0, [ %o7 + 8 ]
0xfefc62b0 <t_splay+476>:       b  0xfefc60dc <t_splay+8>
0xfefc62b4 <t_splay+480>:       ld  [ %i0 + 8 ], %o7
0xfefc62b8 <t_splay+484>:       ret
0xfefc62bc <t_splay+488>:       restore
End of assembler dump.

Thanks,

Orlando M. Betancourt
Solipsys Corporation
e-mail: Orlando.Betancourt@solipsys.com

msgTest2.ii.gz


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