public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Compile libcilkrts with -funwind-tables (PR target/60290)
@ 2016-04-06 11:12 Rainer Orth
  2016-04-22 15:53 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2016-04-06 11:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ilya Verbin, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 3141 bytes --]

I've finally gotten around to analyzing this testsuite failure on 32-bit
Solaris/x86:

FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O1 -fcilkplus execution test
FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O3 -fcilkplus execution test
FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -O2 -fcilkplus execution test
FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -fcilkplus execution test

The testcase aborts like this:

Thread 2 received signal SIGABRT, Aborted.
[Switching to Thread 1 (LWP 1)]
0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
(gdb) where
#0  0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
#1  0xfe3b2d4f in thr_kill () from /lib/libc.so.1
#2  0xfe2f64da in raise () from /lib/libc.so.1
#3  0xfe2c93ee in abort () from /lib/libc.so.1
#4  0xfe525b37 in _Unwind_Resume (exc=0x80a75a0)
    at /vol/gcc/src/hg/trunk/local/libgcc/unwind.inc:234
#5  0xfe783b85 in __cilkrts_gcc_rethrow (sf=0xfeffdb00)
    at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/except-gcc.cpp:589
#6  0xfe77f0ea in __cilkrts_rethrow (sf=0xfeffdb00)
    at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c:548
#7  0x080513a3 in my_test ()
    at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:38
#8  0x080515bd in main ()
    at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:62

The gcc_assert in _Unwind_Resume triggers since
_Unwind_RaiseException_Phase2 returned _URC_FATAL_PHASE2_ERROR.  I found
that x86_fallback_frame_state had been invoked for this pc:

   0xfe77218e <__cilkrts_rethrow+30>:	add    $0x10,%esp

and returned _URC_END_OF_STACK, which is totally unexpected since
_Unwind_Find_FDE should have found it.  __cilkrts_rethrow is defined in
libcilkrts/cilk-abi.o, but in the 32-bit case EH info is missing:

32-bit:

ro@fuego 339 > elfdump -u .libs/libcilkrts.so|grep rethrow
       0x18def  0x3558c  __cilkrts_gcc_rethrow
  [0x11fc]      initloc:   0x18def [ sdata4 pcrel ]  __cilkrts_gcc_rethrow

64-bit:

ro@fuego 341 > elfdump -u amd64/libcilkrts/.libs/libcilkrts.so|grep rethrow
       0x1c639  0x2010  __cilkrts_rethrow
       0x2388b  0x5510  __cilkrts_gcc_rethrow
   [0x488]      initloc:   0x1c639 [ sdata4 pcrel ]  __cilkrts_rethrow
  [0x3988]      initloc:   0x2388b [ sdata4 pcrel ]  __cilkrts_gcc_rethrow

I traced this to -funwind-tables bein set on 32-bit Linux/x86, while it
is unset on 32-bit Solaris/x86  due to

i386/i386.c (ix86_option_override_internal):

      if (opts->x_flag_asynchronous_unwind_tables == 2)
	opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;

where i386/sol2.h has

#define USE_IX86_FRAME_POINTER 1

while the default is 0.

As expected, compiling libcilkrts with -funwind-tables (which is a no-op
on Linux/x86, Linux/x86_64, and Solaris/amd64) makes the failure go
away.

I'm uncertain if this is ok for mainline at this stage or has to wait
for gcc-7.  Once it goes into mainline, it's probably worth a backport
to all active release branches.

Thoughts?

	Rainer


2016-04-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/60290
	* Makefile.am (GENERAL_FLAGS): Add -funwind-tables.
	* Makefile.in: Regenerate.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-libcilkrts-unwind-tables.patch --]
[-- Type: text/x-patch, Size: 553 bytes --]

# HG changeset patch
# Parent  5ffdfe8da23c38390b9520b92cb76f53dfc3da0b
Compile libcilkrts with -funwind-tables (PR target/60290)

diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am
--- a/libcilkrts/Makefile.am
+++ b/libcilkrts/Makefile.am
@@ -43,6 +43,9 @@ GENERAL_FLAGS = -I$(top_srcdir)/include 
 # Enable Intel Cilk Plus extension
 GENERAL_FLAGS += -fcilkplus
 
+# Always generate unwind tables
+GENERAL_FLAGS += -funwind-tables
+
 AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99
 AM_CPPFLAGS = $(GENERAL_FLAGS)
 AM_LDFLAGS = $(XLDFLAGS)

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile libcilkrts with -funwind-tables (PR target/60290)
  2016-04-06 11:12 Compile libcilkrts with -funwind-tables (PR target/60290) Rainer Orth
@ 2016-04-22 15:53 ` Jeff Law
  2016-04-26  8:56   ` Rainer Orth
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2016-04-22 15:53 UTC (permalink / raw)
  To: Rainer Orth, gcc-patches; +Cc: Ilya Verbin, Jakub Jelinek

On 04/06/2016 05:12 AM, Rainer Orth wrote:
> I've finally gotten around to analyzing this testsuite failure on 32-bit
> Solaris/x86:
>
> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O1 -fcilkplus execution test
> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O3 -fcilkplus execution test
> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -O2 -fcilkplus execution test
> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -fcilkplus execution test
>
> The testcase aborts like this:
>
> Thread 2 received signal SIGABRT, Aborted.
> [Switching to Thread 1 (LWP 1)]
> 0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
> (gdb) where
> #0  0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
> #1  0xfe3b2d4f in thr_kill () from /lib/libc.so.1
> #2  0xfe2f64da in raise () from /lib/libc.so.1
> #3  0xfe2c93ee in abort () from /lib/libc.so.1
> #4  0xfe525b37 in _Unwind_Resume (exc=0x80a75a0)
>      at /vol/gcc/src/hg/trunk/local/libgcc/unwind.inc:234
> #5  0xfe783b85 in __cilkrts_gcc_rethrow (sf=0xfeffdb00)
>      at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/except-gcc.cpp:589
> #6  0xfe77f0ea in __cilkrts_rethrow (sf=0xfeffdb00)
>      at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c:548
> #7  0x080513a3 in my_test ()
>      at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:38
> #8  0x080515bd in main ()
>      at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:62
>
> The gcc_assert in _Unwind_Resume triggers since
> _Unwind_RaiseException_Phase2 returned _URC_FATAL_PHASE2_ERROR.  I found
> that x86_fallback_frame_state had been invoked for this pc:
>
>     0xfe77218e <__cilkrts_rethrow+30>:	add    $0x10,%esp
>
> and returned _URC_END_OF_STACK, which is totally unexpected since
> _Unwind_Find_FDE should have found it.  __cilkrts_rethrow is defined in
> libcilkrts/cilk-abi.o, but in the 32-bit case EH info is missing:
>
> 32-bit:
>
> ro@fuego 339 > elfdump -u .libs/libcilkrts.so|grep rethrow
>         0x18def  0x3558c  __cilkrts_gcc_rethrow
>    [0x11fc]      initloc:   0x18def [ sdata4 pcrel ]  __cilkrts_gcc_rethrow
>
> 64-bit:
>
> ro@fuego 341 > elfdump -u amd64/libcilkrts/.libs/libcilkrts.so|grep rethrow
>         0x1c639  0x2010  __cilkrts_rethrow
>         0x2388b  0x5510  __cilkrts_gcc_rethrow
>     [0x488]      initloc:   0x1c639 [ sdata4 pcrel ]  __cilkrts_rethrow
>    [0x3988]      initloc:   0x2388b [ sdata4 pcrel ]  __cilkrts_gcc_rethrow
>
> I traced this to -funwind-tables bein set on 32-bit Linux/x86, while it
> is unset on 32-bit Solaris/x86  due to
>
> i386/i386.c (ix86_option_override_internal):
>
>        if (opts->x_flag_asynchronous_unwind_tables == 2)
> 	opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;
>
> where i386/sol2.h has
>
> #define USE_IX86_FRAME_POINTER 1
>
> while the default is 0.
>
> As expected, compiling libcilkrts with -funwind-tables (which is a no-op
> on Linux/x86, Linux/x86_64, and Solaris/amd64) makes the failure go
> away.
>
> I'm uncertain if this is ok for mainline at this stage or has to wait
> for gcc-7.  Once it goes into mainline, it's probably worth a backport
> to all active release branches.
>
> Thoughts?
>
> 	Rainer
>
>
> 2016-04-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	PR target/60290
> 	* Makefile.am (GENERAL_FLAGS): Add -funwind-tables.
> 	* Makefile.in: Regenerate.
OK.  Thanks for tracking this down, including verification that the 
difference between Solaris and Linux is the latter having 
-funwind-tables on by default.

jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile libcilkrts with -funwind-tables (PR target/60290)
  2016-04-22 15:53 ` Jeff Law
@ 2016-04-26  8:56   ` Rainer Orth
  2016-04-26  8:58     ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2016-04-26  8:56 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, Ilya Verbin, Jakub Jelinek

Hi Jeff,

> On 04/06/2016 05:12 AM, Rainer Orth wrote:
>> I've finally gotten around to analyzing this testsuite failure on 32-bit
>> Solaris/x86:
>>
>> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O1 -fcilkplus execution test
>> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -O3 -fcilkplus execution test
>> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -O2 -fcilkplus execution test
>> FAIL: g++.dg/cilk-plus/CK/catch_exc.cc  -g -fcilkplus execution test
>>
>> The testcase aborts like this:
>>
>> Thread 2 received signal SIGABRT, Aborted.
>> [Switching to Thread 1 (LWP 1)]
>> 0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
>> (gdb) where
>> #0  0xfe3ba3c5 in __lwp_sigqueue () from /lib/libc.so.1
>> #1  0xfe3b2d4f in thr_kill () from /lib/libc.so.1
>> #2  0xfe2f64da in raise () from /lib/libc.so.1
>> #3  0xfe2c93ee in abort () from /lib/libc.so.1
>> #4  0xfe525b37 in _Unwind_Resume (exc=0x80a75a0)
>>      at /vol/gcc/src/hg/trunk/local/libgcc/unwind.inc:234
>> #5  0xfe783b85 in __cilkrts_gcc_rethrow (sf=0xfeffdb00)
>>      at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/except-gcc.cpp:589
>> #6  0xfe77f0ea in __cilkrts_rethrow (sf=0xfeffdb00)
>>      at /vol/gcc/src/hg/trunk/local/libcilkrts/runtime/cilk-abi.c:548
>> #7  0x080513a3 in my_test ()
>>      at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:38
>> #8  0x080515bd in main ()
>>      at /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/cilk-plus/CK/catch_exc.cc:62
>>
>> The gcc_assert in _Unwind_Resume triggers since
>> _Unwind_RaiseException_Phase2 returned _URC_FATAL_PHASE2_ERROR.  I found
>> that x86_fallback_frame_state had been invoked for this pc:
>>
>>     0xfe77218e <__cilkrts_rethrow+30>:	add    $0x10,%esp
>>
>> and returned _URC_END_OF_STACK, which is totally unexpected since
>> _Unwind_Find_FDE should have found it.  __cilkrts_rethrow is defined in
>> libcilkrts/cilk-abi.o, but in the 32-bit case EH info is missing:
>>
>> 32-bit:
>>
>> ro@fuego 339 > elfdump -u .libs/libcilkrts.so|grep rethrow
>>         0x18def  0x3558c  __cilkrts_gcc_rethrow
>>    [0x11fc]      initloc:   0x18def [ sdata4 pcrel ]  __cilkrts_gcc_rethrow
>>
>> 64-bit:
>>
>> ro@fuego 341 > elfdump -u amd64/libcilkrts/.libs/libcilkrts.so|grep rethrow
>>         0x1c639  0x2010  __cilkrts_rethrow
>>         0x2388b  0x5510  __cilkrts_gcc_rethrow
>>     [0x488]      initloc:   0x1c639 [ sdata4 pcrel ]  __cilkrts_rethrow
>>    [0x3988]      initloc:   0x2388b [ sdata4 pcrel ]  __cilkrts_gcc_rethrow
>>
>> I traced this to -funwind-tables bein set on 32-bit Linux/x86, while it
>> is unset on 32-bit Solaris/x86  due to
>>
>> i386/i386.c (ix86_option_override_internal):
>>
>>        if (opts->x_flag_asynchronous_unwind_tables == 2)
>> 	opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;
>>
>> where i386/sol2.h has
>>
>> #define USE_IX86_FRAME_POINTER 1
>>
>> while the default is 0.
>>
>> As expected, compiling libcilkrts with -funwind-tables (which is a no-op
>> on Linux/x86, Linux/x86_64, and Solaris/amd64) makes the failure go
>> away.
>>
>> I'm uncertain if this is ok for mainline at this stage or has to wait
>> for gcc-7.  Once it goes into mainline, it's probably worth a backport
>> to all active release branches.
>>
>> Thoughts?
>>
>> 	Rainer
>>
>>
>> 2016-04-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>> 	PR target/60290
>> 	* Makefile.am (GENERAL_FLAGS): Add -funwind-tables.
>> 	* Makefile.in: Regenerate.
> OK.  Thanks for tracking this down, including verification that the
> difference between Solaris and Linux is the latter having -funwind-tables
> on by default.

thanks, installed.  About eventual backports to the 5 and 6 (after 6.1
is released) and maybe even 4.9 branches?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compile libcilkrts with -funwind-tables (PR target/60290)
  2016-04-26  8:56   ` Rainer Orth
@ 2016-04-26  8:58     ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2016-04-26  8:58 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Jeff Law, gcc-patches, Ilya Verbin

On Tue, Apr 26, 2016 at 10:56:16AM +0200, Rainer Orth wrote:
> > OK.  Thanks for tracking this down, including verification that the
> > difference between Solaris and Linux is the latter having -funwind-tables
> > on by default.
> 
> thanks, installed.  About eventual backports to the 5 and 6 (after 6.1
> is released) and maybe even 4.9 branches?

After a week or three on the trunk so that people have a chance to report
issues, yes.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-26  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 11:12 Compile libcilkrts with -funwind-tables (PR target/60290) Rainer Orth
2016-04-22 15:53 ` Jeff Law
2016-04-26  8:56   ` Rainer Orth
2016-04-26  8:58     ` Jakub Jelinek

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).