public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped)
@ 2004-11-24 15:49 askees at appfluent dot com
2004-11-24 18:42 ` [Bug c++/18649] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: askees at appfluent dot com @ 2004-11-24 15:49 UTC (permalink / raw)
To: gcc-bugs
The threaded program used in this ticket crashes intermittently. The error is
sometimes "terminate called after throwing" and something "unwind called
recursively". A sample stack trace is shown below.
#0 0x00000000 in ?? ()
#1 0xd254ece4 in __gxx_exception_cleanup (code=539406920, exc=0x2026b228)
at /home/downloads/gcc/gcc-3.4.2/libstdc++-v3/libsupc++/eh_throw.cc:52
#2 0xd26bdab0 in _Unwind_DeleteException (exc=0x2026b228)
at /home/downloads/gcc/gcc-3.4.2/gcc/unwind.inc:277
#3 0xd2548530 in __cxa_end_catch ()
at /home/downloads/gcc/gcc-3.4.2/libstdc++-v3/libsupc++/eh_catch.cc:119
#4 0x1000049c in thread_handler ()
#5 0xd004a410 in _pthread_body () from /usr/lib/libpthreads.a(shr_xpg5.o)
#6 0x00000000 in ?? ()
#7 0x00000000 in ?? ()
Previous frame identical to this frame (corrupt stack?)
To reproduce the bug, copy this program to "main.cpp" and compile it with "g++ -
pthread main.cpp". Then, run the program with "while ./a.out do sleep 1;
done". After a minute or so, the program will die. (It doesn't die every
time, so that is why you need to run it in the loop.)
======================================================================
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/timeb.h>
#define NUM_THREADS 200
#define NUM_LOOPS 1000
pthread_mutexattr_t cs_attr;
pthread_mutex_t cs;
int cnt;
void*
thread_handler(void* idptr)
{
printf("thread_handler (start)\n");
for (int i=0; i<NUM_LOOPS; ++i)
{
try
{
throw "nothing";
}
catch(...)
{
//pthread_mutex_lock(&cs);
time_t now = time(0);
struct tm now_tm;
localtime_r(&now, &now_tm);
//pthread_mutex_unlock(&cs);
}
}
pthread_mutex_lock(&cs);
++cnt;
pthread_mutex_unlock(&cs);
printf("thread_handler (stop)\n");
return NULL;
}
int
main(int argc, char** argv)
{
pthread_mutexattr_settype(&cs_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&cs, &cs_attr);
cnt = 0;
for (int i=0; i<NUM_THREADS; ++i)
{
pthread_attr_t attr;
int err = pthread_attr_init(&attr);
if (err != 0)
{
printf("Could not initialize thread [errno=%d]\n", err);
return 1;
}
err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (err != 0)
{
printf("Could not set detachable thread [errno=%d]\n", err);
return 1;
}
pthread_t thread;
err = pthread_create(&thread, &attr, thread_handler, (void*)NULL);
if (err != 0)
{
printf("Could not create thread [errno=%d]\n", err);
return 1;
}
}
bool stop = false;
while(!stop)
{
sleep(1);
pthread_mutex_lock(&cs);
stop = (cnt == NUM_THREADS);
printf("*** cnt = %d\n", cnt);
pthread_mutex_unlock(&cs);
}
return 0;
}
======================================================================
gcc was configured as follows.
configure --enable-threads=posix --prefix=/usr/local/gcc/gcc-3.x.x --enable-lang
uages=c,c++ --disable-multilib
--
Summary: terminate called after throwing - IOT/Abort trap (core
dumped)
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: askees at appfluent dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: powerpc-ibm-aix5.1.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
@ 2004-11-24 18:42 ` pinskia at gcc dot gnu dot org
2004-11-24 21:29 ` askees at appfluent dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-24 18:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-24 18:41 -------
This is already fixed in 3.4.3 and it is a dup of bug 13391.
*** This bug has been marked as a duplicate of 13391 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
2004-11-24 18:42 ` [Bug c++/18649] " pinskia at gcc dot gnu dot org
@ 2004-11-24 21:29 ` askees at appfluent dot com
2004-12-06 5:03 ` [Bug target/18649] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: askees at appfluent dot com @ 2004-11-24 21:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From askees at appfluent dot com 2004-11-24 21:29 -------
I downloaded 3.4.3 and the bug still exists. So, it is not a duplicate of
13391.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
Version|3.4.2 |3.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
2004-11-24 18:42 ` [Bug c++/18649] " pinskia at gcc dot gnu dot org
2004-11-24 21:29 ` askees at appfluent dot com
@ 2004-12-06 5:03 ` pinskia at gcc dot gnu dot org
2005-04-08 20:18 ` cmchugh at callixa dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-06 5:03 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |target
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
` (2 preceding siblings ...)
2004-12-06 5:03 ` [Bug target/18649] " pinskia at gcc dot gnu dot org
@ 2005-04-08 20:18 ` cmchugh at callixa dot com
2005-04-13 0:41 ` cmchugh at callixa dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cmchugh at callixa dot com @ 2005-04-08 20:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cmchugh at callixa dot com 2005-04-08 20:18 -------
I downloaded and built 3.4.3 on AIX 5.2, and this bug does still exist; I tried
the following program (scarfed from 13391) and it crashes every time. Is there
any resolution/fix ?
bluetrance:13391$ more a2.cpp
void mycall()
{
throw 0;
}
bluetrance:13391$ more a1.cpp
extern void mycall();
int main()
{
try {
mycall();
} catch (int i) {
return i;
}
return 1;
}
bluetrance:13391$ g++ -fPIC -DPIC -shared -o liba2.a a2.cpp
bluetrance:13391$ g++ -fPIC -DPIC -o a1 a1.cpp -L. -la2
bluetrance:13391$ a1
terminate called after throwing an instance of 'i'
IOT/Abort trap (core dumped)
bluetrance:build$ g++ --v
Reading specs from /usr/local/bin/../lib/gcc/powerpc-ibm-aix5.2.0.0/3.4.3/specs
Configured with: /export/xtegra3/gcc-3.4.3/gcc-3.4.3/configure
--enable-languages=c,c++ --enable-threads=aix --disable-nls
--prefix=/export/xtegra3/gcc-3.4.3/installdir
Thread model: aix
gcc version 3.4.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
` (3 preceding siblings ...)
2005-04-08 20:18 ` cmchugh at callixa dot com
@ 2005-04-13 0:41 ` cmchugh at callixa dot com
2005-07-22 23:42 ` pinskia at gcc dot gnu dot org
2005-08-11 9:18 ` jkj at sco dot com
6 siblings, 0 replies; 8+ messages in thread
From: cmchugh at callixa dot com @ 2005-04-13 0:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cmchugh at callixa dot com 2005-04-13 00:41 -------
If I compile and link the example in my last comment (shown below) with
-pthread, it will always run. If I don't it will always core dump. This is with
g++ 3.4.3 on AIX 5.2. Does anyone know if the same program compiled with g++
3.3.3 will behave the same way on AIX 5.2 ? (i.e. run okay when compiled and
linked with -pthread but abort otherwise ?)
bluetrance:13391$ cat a2.cpp
void mycall()
{
throw 0;
}
bluetrance:13391$ cat a1.cpp
extern void mycall();
int main()
{
try {
mycall();
} catch (int i) {
return i;
}
return 1;
}
bluetrance:13391$ g++ -fPIC -DPIC -shared -pthread -o liba2.a a2.cpp
bluetrance:13391$ g++ -fPIC -DPIC -o a1 a1.cpp -pthread -L. -la2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
` (4 preceding siblings ...)
2005-04-13 0:41 ` cmchugh at callixa dot com
@ 2005-07-22 23:42 ` pinskia at gcc dot gnu dot org
2005-08-11 9:18 ` jkj at sco dot com
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 23:42 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|powerpc-ibm-aix5.1.0.0 |
GCC target triplet| |powerpc-ibm-aix5.1.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/18649] terminate called after throwing - IOT/Abort trap (core dumped)
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
` (5 preceding siblings ...)
2005-07-22 23:42 ` pinskia at gcc dot gnu dot org
@ 2005-08-11 9:18 ` jkj at sco dot com
6 siblings, 0 replies; 8+ messages in thread
From: jkj at sco dot com @ 2005-08-11 9:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jkj at sco dot com 2005-08-11 09:18 -------
On UnixWare I have a very similar failure. It seems to be -fPIC that's wreaking
the havoc. I have an almost identical test case, and it aborts with:
terminate called after throwing an instance of 'int'
terminate called recursively
This only happens when compiling a2.cpp with -fPIC and producing a .so. If you
link the two together, it works fine. This was with 3.4.4.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18649
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-08-11 9:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24 15:49 [Bug c++/18649] New: terminate called after throwing - IOT/Abort trap (core dumped) askees at appfluent dot com
2004-11-24 18:42 ` [Bug c++/18649] " pinskia at gcc dot gnu dot org
2004-11-24 21:29 ` askees at appfluent dot com
2004-12-06 5:03 ` [Bug target/18649] " pinskia at gcc dot gnu dot org
2005-04-08 20:18 ` cmchugh at callixa dot com
2005-04-13 0:41 ` cmchugh at callixa dot com
2005-07-22 23:42 ` pinskia at gcc dot gnu dot org
2005-08-11 9:18 ` jkj at sco dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).