Subject: bug#46495: 28.0.50; [native-comp] Build fails for 32bit --with-wide-int

From: Eli Zaretskii <[email-masked]>
Date: Tue, 30 Mar 2021 10:50:05 +0300

> From: Andrea Corallo <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, [email-masked],
>         [email-masked]
> Date: Mon, 29 Mar 2021 20:46:27 +0000
> 
> > (c) Alternatively, maybe a bug in the emacs jit stuff that's corrupting
> > the stack somehow?
> 
> I think as suggested compiling a simple function on Eli's system like
> the hello word may give a strong indication on if this is Emacs related
> or not.

I have the hello world example from the libgccjit tutorial compiled
here, but I'm not sure what would you like me to test there.

Here's what I did:

  . compiled the example with -gdwarf-4 -g3
  . started GDB and ran the program until it calls the 'greet'
    function
  . used "si" and "ni" commands to step into 'greet' and through the
    functions it calls

The below is the transcript of that GDB session.  Note how a valid
backtrace sometimes become incomplete and uses "??" for some functions
that are correctly identified by their names at other times.

Does this provide the evidence you wanted to see?  Does it mean that
GDB is sometimes unable to determine the beginning of libgccjit
generated functions, at least on MS-Windows?

  D:\usr\eli\libgccjit>gdb ./tut01-hello-world_d.exe
  GNU gdb (GDB) 10.1
  Copyright (C) 2020 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  Type "show copying" and "show warranty" for details.
  This GDB was configured as "i686-pc-mingw32".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <https://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
      <http://www.gnu.org/software/gdb/documentation/>.

  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from ./tut01-hello-world_d.exe...
  (gdb) start
  Temporary breakpoint 1 at 0x4015c2: file tut01-hello-world.c, line 81.
  Starting program: D:\usr\eli\libgccjit\tut01-hello-world_d.exe

  Temporary breakpoint 1, main (argc=1, argv=0x3e2978) at tut01-hello-world.c:81
  81        ctxt = gcc_jit_context_acquire ();
  (gdb) until 117
  main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  117       greet ("world");
  (gdb) si
  0x004016d3      117       greet ("world");
  (gdb)
  0x004016d7      117       greet ("world");
  (gdb)
  0x66a41280 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) bt
  #0  0x66a41280 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #1  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) ni
  0x66a41281 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb)
  0x66a41283 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) si
  0x66a41286 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) si
  0x66a41289 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) si
  0x66a4128d in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) si
  0x66a41294 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb)
  0x66a41ad8 in printf ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) bt
  #0  0x66a41ad8 in printf ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #1  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #2  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) si
  0x77c4186a in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c4186c in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c41871 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37420 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37425 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3742b in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3742c in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37430 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37434 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37438 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3743a in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3743b in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3743c in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3743d in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37440 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37443 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37444 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c37444 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #2  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) si
  0x77c37447 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3744e in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37451 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c37454 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3745a in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c41876 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c4187b in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c4187c in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c4187e in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b914 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b916 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b917 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b919 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b91c in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b91f in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b921 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c3b921 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  #2  0x00000001 in ?? ()
  #3  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #4  0x00000000 in ?? ()
  (gdb) si
  0x77c3b924 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3b925 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5bb in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5bd in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5be in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5c0 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5c3 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5c4 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5cb in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5ce in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5e3 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x77c3a5e5 in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) si
  0x7c901000 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) bt
  #0  0x7c901000 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  #1  0x77c3a5eb in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #2  0x77c3b92a in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #3  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  #4  0x00000001 in ?? ()
  #5  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #6  0x00000000 in ?? ()
  (gdb) ni
  0x7c901007 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c90100b in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c90100f in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901060 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901063 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901066 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901080 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901083 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901088 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c90108d in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901092 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901094 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c901097 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c90109e in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c9010a1 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c9010a4 in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c9010ab in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x7c9010ad in ntdll!RtlEnterCriticalSection ()
     from C:\WINDOWS\system32\ntdll.dll
  (gdb) ni
  0x77c3a5eb in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c3a5eb in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x77c3b92a in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #2  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  #3  0x00000001 in ?? ()
  #4  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #5  0x00000000 in ?? ()
  (gdb) ni
  0x77c3a5ec in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3a5ed in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3b92a in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c3b92a in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  #2  0x00000001 in ?? ()
  #3  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #4  0x00000000 in ?? ()
  (gdb) ni
  0x77c3b92b in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3b92c in msvcrt!_lock () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c41883 in printf () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x00000001 in ?? ()
  #2  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #3  0x00000000 in ?? ()
  (gdb) ni
  0x77c41884 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41885 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41889 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c4188a in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c4188f in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c4188f in printf () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #2  0x00000000 in ?? ()
  (gdb) ni
  0x77c41892 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41895 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41896 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c41899 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c4189a in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c4189f in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418a2 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418a3 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418a6 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  hello world
  0x77c418ab in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c418ab in printf () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x00000001 in ?? ()
  #2  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #3  0x77c5fca0 in msvcrt!_iob () from C:\WINDOWS\system32\msvcrt.dll
  #4  0x66a43044 in ?? ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #5  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #6  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) ni
  0x77c418ae in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418b2 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418b7 in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418ba in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3745b in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c3745b in strerror () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #2  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) ni
  0x77c3745e in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c37465 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c37466 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c37467 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c37468 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c37469 in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3746a in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c3746b in strerror () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) ni
  0x77c418bf in printf () from C:\WINDOWS\system32\msvcrt.dll
  (gdb) bt
  #0  0x77c418bf in printf () from C:\WINDOWS\system32\msvcrt.dll
  #1  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #2  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) ni
  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) bt
  #0  0x66a41299 in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  #1  0x004016d9 in main (argc=1, argv=0x3e2978) at tut01-hello-world.c:117
  (gdb) ni
  0x66a4129a in greet ()
     from C:\DOCUME~1\Zaretzky\LOCALS~1\Temp\libgccjit-wf9bcr\fake.so
  (gdb) ni
  main (argc=1, argv=0x3e2978) at tut01-hello-world.c:118
  118       fflush (stdout);
  (gdb) bt
  #0  main (argc=1, argv=0x3e2978) at tut01-hello-world.c:118
  (gdb) c
  Continuing.
  [Inferior 1 (process 7076) exited normally]
  (gdb)