[patch] Update catch(...) handlers to deal with __forced_unwind
Jonathan Wakely
jwakely@redhat.com
Fri Jun 6 14:31:00 GMT 2014
On 06/06/14 12:40 +0200, Uros Bizjak wrote:
>On Fri, Jun 6, 2014 at 11:19 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On 06/06/14 10:27 +0200, Uros Bizjak wrote:
>>>
>>> These two tests timeout on alpha-linux-gnu:
>>>
>>> FAIL: 30_threads/async/forced_unwind.cc execution test
>>> WARNING: program timed out.
>>> FAIL: 30_threads/packaged_task/forced_unwind.cc execution test
>>> WARNING: program timed out.
>>
>>
>> Sorry about that, I don't know why.
>>
>> Does pthread_exit(0) use a __forced_unwind exception on
>> alpha-linux-gnu? This should tell you ...
>>
>>
>> #include <bits/cxxabi_forced.h>
>> #include <pthread.h>
>>
>> void* f(void*) {
>> try
>> {
>> pthread_exit(0);
>> }
>> catch (__cxxabiv1::__forced_unwind const&)
>> {
>> __builtin_puts("unwind");
>> throw;
>> }
>> catch (...)
>> {
>> __builtin_puts("something else");
>> throw;
>> }
>> }
>>
>> int main()
>> {
>> pthread_t t;
>> pthread_create(&t, 0, f, 0);
>> pthread_join(t, 0);
>>
>> }
>
>Strange, I don't get anything ...
>
>$ g++ -lpthread pt.C
>$ ./a.out
That explains it then: the thread just goes away, and the waiting
function hangs forever expecting the future to be made ready.
The test assumes pthread_exit is implemented by throwing
__forced_unwind, which apparently isn't true for all glibc targets.
If the thread just goes away there's no way to make the future ready.
I guess we should just XFAIL it for alpha, and maybe other targets.
More information about the Gcc-patches
mailing list