You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/07/08 23:50:04 UTC

[jira] Commented: (STDCXX-476) [Intel Thread Checker 3.1] calls std::terminate() after throwing exception of class type

    [ https://issues.apache.org/jira/browse/STDCXX-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511002 ] 

Martin Sebor commented on STDCXX-476:
-------------------------------------

A simplified test case is below. Compiling without the -cxxlib-nostd option lets the program run successfully to completion. The same thing happens when using gcc vs g++ to compile the program (compiling with gcc and linking with -lsupc++ causes a call to terminate() while using g++ does not):

$ cat t.cpp && icc --version && icc -cxxlib-nostd -pthread t.cpp -lcxaguard -lsupc++ && tcheck_cl a.out
#include <pthread.h>
#include <stdio.h>

int loop;

extern "C" void* thread_proc (void*)
{
    for (loop = 0; loop != 2; ++loop) {
        printf ("%d\n", loop);
        try { throw 0; }
        catch (...) { }
    }

    return 0;
}


int main ()
{
    pthread_t tid;

    if (pthread_create (&tid, 0, thread_proc, 0))
        return 1;

    pthread_join (tid, 0);
}
icc (ICC) 10.0 20070613
Copyright (C) 1985-2007 Intel Corporation.  All rights reserved.

Intel(R) Thread Checker 3.1 command line instrumentation driver (24400)
Copyright (c) 2007 Intel Corporation. All rights reserved.
Building project
Instrumenting
 12% a.out           ( All Functions ):..

Running:  /build/sebor/stdcxx-icc-10.0.025-15S/examples/a.out 

0
terminate called after throwing an instance of 'int'

Application finished

_______________________________________________________________________________
|ID|Short Des|Severi|Co|Context[|Description                  |1st Acc|2nd Acc|
|  |cription |ty    |un|Best]   |                             |ess[Bes|ess[Bes|
|  |         |Name  |t |        |                             |t]     |t]     |
_______________________________________________________________________________
|1 |Thread te|Inform|1 |Whole   |Thread termination at [a.out,|[a.out,|[a.out,|
|  |rmination|ation |  |Program1|0x1c85] - includes stack     |0x1c85]|0x1c85]|
|  |         |      |  |        |allocation of 10.004 MB and  |       |       |
|  |         |      |  |        |use of 7.203 KB              |       |       |
_______________________________________________________________________________
|2 |Thread te|Inform|1 |Whole   |Thread termination at [a.out,|[a.out,|[a.out,|
|  |rmination|ation |  |Program2|0x1c58] - includes stack     |0x1c58]|0x1c58]|
|  |         |      |  |        |allocation of 10 MB and use  |       |       |
|  |         |      |  |        |of 3.453 KB                  |       |       |
_______________________________________________________________________________



> [Intel Thread Checker 3.1] calls std::terminate() after throwing exception of class type
> ----------------------------------------------------------------------------------------
>
>                 Key: STDCXX-476
>                 URL: https://issues.apache.org/jira/browse/STDCXX-476
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: Intel Thread Checker 3.1
>            Reporter: Martin Sebor
>
> Running a program that throws and catches an exception of user-defined type in a thread function through the thread checker causes a call to terminate():
>  cat t.cpp && make t && icc -v && tcheck_cl t
> #include <pthread.h>
> #include <stdio.h>
> struct S { };
> int loop;
> extern "C" void* thread_proc (void*)
> {
>     for (loop = 0; loop != 2; ++loop) {
>         printf ("%d\n", loop);
>         try { throw S (); }
>         catch (...) { }
>     }
>     return 0;
> }
> int main ()
> {
>     pthread_t tid;
>     if (pthread_create (&tid, 0, thread_proc, 0))
>         return 1;
>     pthread_join (tid, 0);
> }
> icc -c -I/home/sebor/stdcxx/include/ansi -D_RWSTDDEBUG   -D_REENTRANT -I/home/sebor/stdcxx/include -I/build/sebor/stdcxx-icc-10.0.025-15S/include -I/home/sebor/stdcxx/examples/include  -cxxlib-nostd -g   -w1   t.cpp
> icc t.o -o t -cxxlib-nostd  -lpthread  -L/build/sebor/stdcxx-icc-10.0.025-15S/lib  -lstd15S -lcxaguard -lsupc++ -lm 
> Version 10.0 
> Intel(R) Thread Checker 3.1 command line instrumentation driver (24400)
> Copyright (c) 2007 Intel Corporation. All rights reserved.
> Building project
> Instrumenting
>  11% t               ( All Functions ):..
> Running:  /build/sebor/stdcxx-icc-10.0.025-15S/examples/t 
> 0
> terminate called after throwing an instance of 'S'
> Application finished
> _______________________________________________________________________________
> |ID|Short Des|Severit|Co|Context|Description                   |1st Ac|2nd Acc|
> |  |cription |y Name |un|[Best] |                              |cess[B|ess[Bes|
> |  |         |       |t |       |                              |est]  |t]     |
> _______________________________________________________________________________
> |1 |Thread te|Informa|1 |Whole  |Thread termination at         |"t.cpp|"t.cpp"|
> |  |rmination|tion   |  |Program|"t.cpp":24 - includes stack   |":24  |:24    |
> |  |         |       |  |1      |allocation of 10.004 MB and   |      |       |
> |  |         |       |  |       |use of 7.281 KB               |      |       |
> _______________________________________________________________________________
> |2 |Thread te|Informa|1 |Whole  |Thread termination at         |"t.cpp|"t.cpp"|
> |  |rmination|tion   |  |Program|"t.cpp":21 - includes stack   |":21  |:21    |
> |  |         |       |  |2      |allocation of 10 MB and use of|      |       |
> |  |         |       |  |       |4.938 KB                      |      |       |
> _______________________________________________________________________________

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.