unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Andrea Corallo <akrl@sdf.org>, 47067@debbugs.gnu.org
Subject: bug#47067: 28.0.50; [feature/native-comp] Crash while scrolling through dispnew.c
Date: Sun, 14 Mar 2021 12:17:35 +0000	[thread overview]
Message-ID: <CAOqdjBdBJ75NR6zAjYWib5=d+UNy6mcX+KsNo-JncNGu0j0_eQ@mail.gmail.com> (raw)
In-Reply-To: <CAOqdjBceiReOUYW1LEoyuv2+1W9Bx965dze0qYHjq8jLP0forg@mail.gmail.com>

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

On Sun, Mar 14, 2021 at 12:09 PM Pip Cet <pipcet@gmail.com> wrote:
> On Sun, Mar 14, 2021 at 12:07 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > So I think this should be pushed, with the corresponding bump of the
> > ABI version.
>
> I'll prepare a version which actually changes the ABI and bumps the ABI version.

Still don't have a Windows machine (and I gave up on setting up a Wine
environment for Emacs testing), so can someone check this compiles on
WINDOWSNT and avoids the crash?

Any nitpicks would, as always, be appreciated, too!

Pip

[-- Attachment #2: 0001-Don-t-call-setjmp-through-a-function-pointer-on-Wind.patch --]
[-- Type: text/x-patch, Size: 2587 bytes --]

From 980929876c9fa6db046eef021854be20a8d49875 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Sun, 14 Mar 2021 12:13:40 +0000
Subject: [PATCH] Don't call setjmp through a function pointer on Windows
 (bug#47067)

* src/comp.c (ABI_VERSION): Bump.
(emit_setjmp): Call setjmp directly.
(declare_runtime_imported_funcs): Remove setjmp.
(helper_link_table): Remove entry for setjmp.
---
 src/comp.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/comp.c b/src/comp.c
index 2ed893cbe0404..7d10f1f2b6926 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -429,7 +429,7 @@ load_gccjit_if_necessary (bool mandatory)
 
 \f
 /* Increase this number to force a new Vcomp_abi_hash to be generated.  */
-#define ABI_VERSION "3"
+#define ABI_VERSION "4"
 
 /* Length of the hashes used for eln file naming.  */
 #define HASH_LENGTH 8
@@ -654,9 +654,6 @@ #define NUM_CAST_TYPES 15
     helper_PSEUDOVECTOR_TYPEP_XUNTAG,
     pure_write_error,
     push_handler,
-#ifdef WINDOWSNT
-    SETJMP_NAME,
-#endif
     record_unwind_protect_excursion,
     helper_unbind_n,
     helper_save_restriction,
@@ -1972,6 +1969,11 @@ emit_setjmp (gcc_jit_rvalue *buf)
   return gcc_jit_context_new_call (comp.ctxt, NULL, f, 1, args);
 #else
   /* _setjmp (buf, __builtin_frame_address (0)) */
+  gcc_jit_param *params[] =
+  {
+    gcc_jit_context_new_param (comp.ctxt, NULL, comp.void_ptr_type, "buf"),
+    gcc_jit_context_new_param (comp.ctxt, NULL, comp.void_ptr_type, "frame"),
+  };
   gcc_jit_rvalue *args[2];
 
   args[0] =
@@ -1985,8 +1987,14 @@ emit_setjmp (gcc_jit_rvalue *buf)
 					    "__builtin_frame_address"),
       1, args);
   args[0] = buf;
-  return emit_call (intern_c_string (STR (SETJMP_NAME)), comp.int_type, 2, args,
-                    false);
+  gcc_jit_function *f =
+    gcc_jit_context_new_function (comp.ctxt, NULL,
+				  GCC_JIT_FUNCTION_IMPORTED,
+				  comp.int_type, STR (SETJMP_NAME),
+				  ARRAYELTS (params), params,
+				  false);
+
+  return gcc_jit_context_new_call (comp.ctxt, NULL, f, 2, args);
 #endif
 }
 
@@ -2701,12 +2709,6 @@ #define ADD_IMPORTED(f_name, ret_type, nargs, args)			       \
   args[1] = comp.int_type;
   ADD_IMPORTED (push_handler, comp.handler_ptr_type, 2, args);
 
-#ifdef WINDOWSNT
-  args[0] = gcc_jit_type_get_pointer (gcc_jit_struct_as_type (comp.jmp_buf_s));
-  args[1] = comp.void_ptr_type;
-  ADD_IMPORTED (SETJMP_NAME, comp.int_type, 2, args);
-#endif
-
   ADD_IMPORTED (record_unwind_protect_excursion, comp.void_type, 0, NULL);
 
   args[0] = comp.lisp_obj_type;
-- 
2.30.1


  reply	other threads:[~2021-03-14 12:17 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 11:27 bug#47067: 28.0.50; [feature/native-comp] Crash while scrolling through dispnew.c Eli Zaretskii
2021-03-11 12:19 ` Eli Zaretskii
2021-03-11 14:07 ` Eli Zaretskii
2021-03-12  6:46 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12  8:10   ` Eli Zaretskii
2021-03-12 12:04     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 12:51       ` Eli Zaretskii
2021-03-12 15:27         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 15:50           ` Eli Zaretskii
2021-03-12 16:08             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 16:14               ` Eli Zaretskii
2021-03-12 19:30                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 19:48                   ` Eli Zaretskii
2021-03-12 20:21                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13  7:11                       ` Eli Zaretskii
2021-03-13 19:51                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13 20:07                           ` Eli Zaretskii
2021-03-13 20:20                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  7:19                               ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  8:02                                 ` Eli Zaretskii
2021-03-14  8:10                                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14 19:29                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13 19:48                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 16:23               ` Eli Zaretskii
2021-03-12 19:04                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 19:32                   ` Eli Zaretskii
2021-03-12 20:10                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13  8:34                       ` Eli Zaretskii
2021-03-19  9:42                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-19 12:10                           ` Eli Zaretskii
2021-03-19 14:05                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-19 14:09                               ` Eli Zaretskii
2021-03-20  9:52                                 ` Eli Zaretskii
2021-03-21  8:26                                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21  9:52                                     ` Eli Zaretskii
2021-03-21 11:56                                       ` Eli Zaretskii
2021-03-21 14:37                                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 15:34                                           ` Eli Zaretskii
2021-03-21 15:41                                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 15:54                                               ` Eli Zaretskii
2021-03-21 16:41                                                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-21 17:01                                                   ` Eli Zaretskii
2021-03-21 18:36                                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 16:51                                                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 17:03                                                         ` Eli Zaretskii
2021-03-25 20:24                                                           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-25 20:43                                                             ` Eli Zaretskii
2021-04-04 20:52                                                               ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-05 15:06                                                                 ` Eli Zaretskii
2021-04-05 16:09                                                                   ` Eli Zaretskii
2021-04-05 17:58                                                                     ` Eli Zaretskii
2021-04-06 13:17                                                                       ` Eli Zaretskii
2021-04-06 13:29                                                                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-06 13:53                                                                           ` Eli Zaretskii
2021-04-06 14:01                                                                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-05 18:45                                                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-05 18:04                                                                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-05 18:19                                                                     ` Eli Zaretskii
2021-04-05 18:47                                                                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-05 19:22                                                                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-06 15:49                                                                           ` Eli Zaretskii
2021-04-06 16:06                                                                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-06 16:09                                                                               ` Eli Zaretskii
2021-03-21 14:36                                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-12 18:42         ` Pip Cet
2021-03-12 19:50           ` Eli Zaretskii
2021-03-13  8:18             ` Pip Cet
2021-03-13  8:47               ` Eli Zaretskii
2021-03-13  8:53                 ` Pip Cet
2021-03-13 11:10                   ` Eli Zaretskii
2021-03-13 11:23                     ` Eli Zaretskii
2021-03-13 11:24                     ` Pip Cet
2021-03-13 15:27                       ` Eli Zaretskii
2021-03-13 15:45                         ` Pip Cet
2021-03-13 16:21                           ` Eli Zaretskii
2021-03-13 16:32                             ` Pip Cet
2021-03-13 16:53                               ` Eli Zaretskii
2021-03-13 17:10                                 ` Pip Cet
2021-03-13 17:26                                   ` Eli Zaretskii
2021-03-13 18:55                                     ` Pip Cet
2021-03-13 19:43                                       ` Eli Zaretskii
2021-03-13 20:53                                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13 21:00                                   ` Pip Cet
2021-03-13 21:07                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-13 21:11                                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  6:07                                       ` Eli Zaretskii
2021-03-14  6:53                                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  7:21                                           ` Eli Zaretskii
2021-03-14  7:31                                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  7:48                                               ` Eli Zaretskii
2021-03-14  8:02                                                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  8:06                                                 ` Pip Cet
2021-03-14 11:39                                                   ` Eli Zaretskii
2021-03-14 11:44                                                     ` Pip Cet
2021-03-14 12:08                                                       ` Eli Zaretskii
2021-03-14 12:09                                                         ` Pip Cet
2021-03-14 12:17                                                           ` Pip Cet [this message]
2021-03-14 13:31                                                             ` Eli Zaretskii
2021-03-14 14:08                                                               ` Eli Zaretskii
2021-03-14 18:47                                                                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]                                                                   ` <83mtv5frr4.fsf@gnu.org>
2021-03-14 20:30                                                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-15 18:36                                                                       ` Eli Zaretskii
2021-03-15 20:17                                                                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-16 13:25                                                                           ` Eli Zaretskii
2021-03-14  8:03                                               ` Pip Cet
2021-03-14  5:55                                   ` Eli Zaretskii
2021-03-14  6:57                                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14  8:20                                       ` Eli Zaretskii
2021-03-13 17:09                               ` Eli Zaretskii
2021-03-14 12:17                           ` Eli Zaretskii
2021-03-14 19:00                             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-14 19:48                               ` Eli Zaretskii
2021-03-14 20:36                                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-15  3:24                                   ` Eli Zaretskii
2021-03-13 20:03                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAOqdjBdBJ75NR6zAjYWib5=d+UNy6mcX+KsNo-JncNGu0j0_eQ@mail.gmail.com' \
    --to=pipcet@gmail.com \
    --cc=47067@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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