public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Ilya Verbin <iverbin@gmail.com>,
	       Jakub Jelinek <jakub@redhat.com>
Subject: Re: Compile libcilkrts with -funwind-tables (PR target/60290)
Date: Tue, 26 Apr 2016 08:56:00 -0000	[thread overview]
Message-ID: <yddwpnkbvf3.fsf@lokon.CeBiTec.Uni-Bielefeld.DE> (raw)
In-Reply-To: <571A4906.20708@redhat.com> (Jeff Law's message of "Fri, 22 Apr	2016 09:53:42 -0600")

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

  reply	other threads:[~2016-04-26  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 11:12 Rainer Orth
2016-04-22 15:53 ` Jeff Law
2016-04-26  8:56   ` Rainer Orth [this message]
2016-04-26  8:58     ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yddwpnkbvf3.fsf@lokon.CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iverbin@gmail.com \
    --cc=jakub@redhat.com \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).