public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite
@ 2015-01-21 22:06 dmalcolm at gcc dot gnu.org
  2015-01-21 22:11 ` [Bug jit/64721] SIBABRT becomes a " dmalcolm at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-21 22:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

            Bug ID: 64721
           Summary: SIBAGRT turns into SIGSEGV in jit testsuite
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org

Failures of the CHECK_ macros within jit/harness.h call abort(), which ought to
appear in the logs as a FAIL with SIGABRT.

However, they actually lead to a SIGSEGV.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff76e0909 in pp_format (pp=0x0, text=0x7fffffffdac0) at
../../src/gcc/pretty-print.c:282
282      output_buffer *buffer = pp_buffer (pp);
(gdb) bt
#0  0x00007ffff76e0909 in pp_format (pp=0x0, text=0x7fffffffdac0) at
../../src/gcc/pretty-print.c:282
#1  0x00007ffff76de590 in diagnostic_report_diagnostic (context=0x7ffff7ffae40
<global_diagnostic_context>, 
    diagnostic=0x7fffffffdac0) at ../../src/gcc/diagnostic.c:862
#2  0x00007ffff76df772 in internal_error (gmsgid=0x7ffff7787c43 "%s") at
../../src/gcc/diagnostic.c:1237
#3  0x00007ffff6dcc5a6 in crash_signal (signo=6) at ../../src/gcc/toplev.c:381
#4  <signal handler called>
#5  0x0000003095835887 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#6  0x0000003095836f78 in __GI_abort () at abort.c:89
#7  0x0000000000402258 in verify_code (ctxt=0x604010, result=0x63df20)
    at
/home/david/coding-3/gcc-git-jit-pypy/src/gcc/testsuite/jit.dg/test-abort.c:18
#8  0x000000000040213f in test_jit (
    argv0=0x7fffffffe6b8
"/home/david/coding-3/gcc-git-jit-pypy/build/gcc/testsuite/jit/test-abort.c.exe",
user_data=0x0)
    at
/home/david/coding-3/gcc-git-jit-pypy/src/gcc/testsuite/jit.dg/harness.h:346
#9  0x000000000040221e in main (argc=1, argv=0x7fffffffe448)
    at
/home/david/coding-3/gcc-git-jit-pypy/src/gcc/testsuite/jit.dg/harness.h:389

where context->printer is NULL (for the global_diagnostic_context).


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

* [Bug jit/64721] SIBABRT becomes a SIGSEGV in jit testsuite
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
@ 2015-01-21 22:11 ` dmalcolm at gcc dot gnu.org
  2015-01-21 22:12 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-21 22:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|SIBAGRT turns into SIGSEGV  |SIBABRT becomes a SIGSEGV
                   |in jit testsuite            |in jit testsuite

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Currently we unconditionally install crash_handler as a signal_handler, and
this itself (ironically) will crash if called after toplev::main cleans up the
global_diagnostic_context.

Three options:

  (A) We could unregister the signal handlers in toplev::finalize immediately
      before global_diagnostic_context has diagnostic_finish called on it,
      potentially restoring whatever signal handlers were there before.

  (B) Don't register signal-handlers at all when run from inside libgccjit.

  (C) Make creation of global_diagnostic_context be idempotent, and don't
      clean it up.

(B) seems best from the POV of a library that aims to be thread-safe: don't
touch signal-handlers when inside libgccjit.  I have a patch for this.


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

* [Bug jit/64721] SIBABRT becomes a SIGSEGV in jit testsuite
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
  2015-01-21 22:11 ` [Bug jit/64721] SIBABRT becomes a " dmalcolm at gcc dot gnu.org
@ 2015-01-21 22:12 ` dmalcolm at gcc dot gnu.org
  2015-01-21 22:18 ` [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-21 22:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #1)
> Currently we unconditionally install crash_handler as a signal_handler, and
                                       "crash_signal as a signal-handler"
this should have read.


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

* [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
  2015-01-21 22:11 ` [Bug jit/64721] SIBABRT becomes a " dmalcolm at gcc dot gnu.org
  2015-01-21 22:12 ` dmalcolm at gcc dot gnu.org
@ 2015-01-21 22:18 ` dmalcolm at gcc dot gnu.org
  2015-01-22 21:19 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-21 22:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|SIGABRT becomes a SIGSEGV   |SIGABRT becomes a SIGSEGV
                   |in jit testsuite            |after invoking
                   |                            |gcc_jit_context_compile[_to
                   |                            |_file] within a process

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(retitling; it appears that any use of gcc_jit_context_compile[_to_file] that
makes it as far as toplev::main will install the signal-handlers into the
process, leading to SIGSEGV inside libgccjit due e.g. to assert failures in
other DSOs within the process)


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

* [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-01-21 22:18 ` [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process dmalcolm at gcc dot gnu.org
@ 2015-01-22 21:19 ` dmalcolm at gcc dot gnu.org
  2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
  2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-22 21:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #1)
> (B) seems best from the POV of a library that aims to be thread-safe: don't
> touch signal-handlers when inside libgccjit.  I have a patch for this.

Patch posted for review as
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg01958.html


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

* [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
@ 2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-23 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Fri Jan 23 16:28:14 2015
New Revision: 220045

URL: https://gcc.gnu.org/viewcvs?rev=220045&root=gcc&view=rev
Log:
PR jit/64721: toplev: don't install signal-handlers when running within
libgccjit

gcc/ChangeLog:
    PR jit/64721
    * main.c (main): Construct toplev instances with init_signals=true.
    * toplev.c (general_init): Add param "init_signals", and use it to
    conditionalize the calls to signal and host_hooks.extra_signals.
    (toplev::toplev): Add param "init_signals".
    (toplev::main): When invoking general_init, pass m_init_signals
    to control whether signal-handlers are installed.
    * toplev.h (toplev::toplev): Add param "init_signals".
    (toplev::m_init_signals): New field.

gcc/jit/ChangeLog:
    PR jit/64721
    * jit-playback.c (gcc::jit::playback::context::compile): Construct
    toplev instances with init_signals=false.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/jit/ChangeLog
    trunk/gcc/jit/jit-playback.c
    trunk/gcc/main.c
    trunk/gcc/toplev.c
    trunk/gcc/toplev.h

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Fixed in r220045.


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

* [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process
  2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-01-22 21:19 ` dmalcolm at gcc dot gnu.org
@ 2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
  2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2015-01-23 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64721

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Fri Jan 23 16:28:14 2015
New Revision: 220045

URL: https://gcc.gnu.org/viewcvs?rev=220045&root=gcc&view=rev
Log:
PR jit/64721: toplev: don't install signal-handlers when running within
libgccjit

gcc/ChangeLog:
    PR jit/64721
    * main.c (main): Construct toplev instances with init_signals=true.
    * toplev.c (general_init): Add param "init_signals", and use it to
    conditionalize the calls to signal and host_hooks.extra_signals.
    (toplev::toplev): Add param "init_signals".
    (toplev::main): When invoking general_init, pass m_init_signals
    to control whether signal-handlers are installed.
    * toplev.h (toplev::toplev): Add param "init_signals".
    (toplev::m_init_signals): New field.

gcc/jit/ChangeLog:
    PR jit/64721
    * jit-playback.c (gcc::jit::playback::context::compile): Construct
    toplev instances with init_signals=false.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/jit/ChangeLog
    trunk/gcc/jit/jit-playback.c
    trunk/gcc/main.c
    trunk/gcc/toplev.c
    trunk/gcc/toplev.h

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Fixed in r220045.


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

end of thread, other threads:[~2015-01-23 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 22:06 [Bug jit/64721] New: SIBAGRT turns into SIGSEGV in jit testsuite dmalcolm at gcc dot gnu.org
2015-01-21 22:11 ` [Bug jit/64721] SIBABRT becomes a " dmalcolm at gcc dot gnu.org
2015-01-21 22:12 ` dmalcolm at gcc dot gnu.org
2015-01-21 22:18 ` [Bug jit/64721] SIGABRT becomes a SIGSEGV after invoking gcc_jit_context_compile[_to_file] within a process dmalcolm at gcc dot gnu.org
2015-01-22 21:19 ` dmalcolm at gcc dot gnu.org
2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org
2015-01-23 16:31 ` dmalcolm at gcc dot gnu.org

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