Subject: bug#47067: 28.0.50; [feature/native-comp] Crash while scrolling through dispnew.c

From: Pip Cet <[email-masked]>
Date: Sat, 13 Mar 2021 18:55:37 +0000

On Sat, Mar 13, 2021 at 5:26 PM Eli Zaretskii <[email-masked]> wrote:
> > From: Pip Cet <[email-masked]>
> > Date: Sat, 13 Mar 2021 17:10:08 +0000
> > Cc: Andrea Corallo <[email-masked]>, [email-masked]
> >
> > > > It's a long function, that might not have been enough.
> > >
> > > But since I found those two, everything before that is irrelevant,
> > > right?
> >
> > Assuming all code paths hit these insns, yes.
>
> Then tell me how far back to go.
>
> Or, better yet, perhaps there's a way of displaying that code in C?

Sure! Put the defun in a file called breakage.el. Then open emacs -Q
in GDB and evaluate

(require 'comp)
(let ((comp-debug 3) (comp-verbose 3))
  (load (native-compile "breakage.el")))

Then set a GDB breakpoint on
F632d626567696e6e696e672d6f662d73746174656d656e742d31_c_beginning_of_statement_1_0,
continue and evaluate

(c-beginning-of-stmt-1)

In GDB, you should now see the "source" code interspersed with the
disassembly (if you have that enabled).

I'd suggest to try disass/rs next and post the entire output, but you
know your way around gdb much better than I do :-)

The code you're looking for looks like this:

7961      /* calling subr: < */
7962      frame[(int)0] = freloc->R3c__0 ((long long)2, (&frame[(int)0]));
   0x00007fffec660f41 <+3409>:    4c 89 f6    mov    %r14,%rsi
   0x00007fffec660f44 <+3412>:    bf 02 00 00 00    mov    $0x2,%edi

(but different, of course, because of the different architecture).

> > Since mingw (at least the version I could find) declares setjmp with
> > the "returns_twice" attribute, I'm assuming their implementation is
> > not such that you can call it through a function pointer.
>
> I think you are looking at a 64-bit MinGW64, but I'm out of my depth
> here anyway.  If you want to pursue this further, the implementation I
> use is in MSVCRT.DLL.

Thanks!

Pip