Subject: Re: bug#38748: 28.0.50; crash on MacOS 10.15.2

From: Robert Pluim <[email-masked]>
Date: Wed, 08 Jan 2020 22:43:30 +0100

>>>>> On Wed, 8 Jan 2020 19:18:15 +0000, Pip Cet <[email-masked]> said:

    Pip> On Wed, Jan 8, 2020 at 5:40 PM Robert Pluim <[email-masked]> wrote:
    >> >> But I found the commit after which error is occurs:>     >> b2949d39261e82c33572ba8a250298ef0b165b95
    >> >>
    >> >> Commenting out that 'ok = false;' line make Emacs works without errors.
    >> 
    >> I can confirm this.

    Pip> I think we should disassemble the two versions and see where the
    Pip> differences are, unless this is too difficult because of inlining. Can
    Pip> you provide compiler details?

gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Iʼve attached the disassembly of the two versions. They're very very
similar (this is with -g3 -O0).

    Eli> I cannot explain how that change could cause any harm.  Here's the
    Eli> relevant code fragment:

    Eli> So how could the initial value of 'ok' matter here?  What am I
    Eli> missing?

    Pip> I think it's likely to be the stack thing; the ok = false might make
    Pip> the difference between allocating inherited_attrs on the stack once
    Pip> and doing so once per recursion of face_inherited_attr. The latter
    Pip> case might lead to a stack overflow more easily.

The allocation of inherited_attrs is the same in both.

    >> Yes. Iʼll note that when this happens there are over 9000 stackframes,
    >> so perhaps itʼs stack exhaustion. macOS has a default stack of 8192
    >> kB, Iʼll see if increasing it helps.

    Pip> That does sound like infinite recursion, or infinite recursion waiting
    Pip> for something to change asynchronously that breaks the loop. If the
    Pip> "ok = false" prevents the compiler from recognizing
    Pip> face_inherited_attr is effectively tail-recursive, that might be it?

    Pip> Changing the line to "ok = true" would be an interesting experiment.

Hmm, yes. Iʼll try that.

BTW, running under lldb, last_marked can be accessed successfully, but
of course under lldb you donʼt get all the nice commands from
.gdbinit. Iʼd build a newer version of gdb, but signing binaries on
macOS is a real hassle.

Robert