Paul Eggert writes: > On 10/18/18 9:02 AM, Eli Zaretskii wrote: >> Can you please repeat this experiment, and then, when it crashes, do >> this: >> (gdb) source ./.gdbinit >> (gdb) frame 2 >> (gdb) p/x a >> (gdb) xtype >> and show us the results? > Also, please try these GDB commands when debugging ./temacs: > b syms_of_threads > r -Q > p &main_thread > disas syms_of_threads > p &Vmain_thread > I'm attaching the output of these commands on Fedora 28 x86-64 compiled with 'gcc -m32 -march=native -g3 -O2' (AMD Phenom II X4 910e). Evidently your compiler (clang?) is not inlining make_lisp_ptr, but > it's still useful to know what it's up to. I see that GCC optimizes away not only the call to make_lisp_ptr, but also the runtime check 'TAGGEDP (a, type) && XUNTAG (a, type, char) == ptr', I guess because > GCC knows that main_thread is properly aligned so TAGGEDP must succeed here. clang isn't smart enough to do this sort of optimization (at least on Fedora) so if you're using clang that might partly explain > the problem. root@11i386-default:/wrkdirs/usr/ports/editors/emacs-devel/work-full/emacs-e511b9d/src # /usr/local/bin/gdb ./temacs GNU gdb (GDB) 8.2 [GDB v8.2 for FreeBSD] Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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 "i386-portbld-freebsd11.2". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./temacs...done. SIGINT is used by the debugger. Are you sure you want to change it? (y or n) [answered Y; input not from terminal] Environment variable "DISPLAY" not defined. TERM = screen-256color Breakpoint 1 at 0x81599de: file emacs.c, line 370. Temporary breakpoint 2 at 0x8177f95: file sysdep.c, line 1080. (gdb) b syms_of_threads Breakpoint 3 at 0x8249851: file thread.c, line 1098. (gdb) r -Q Starting program: /wrkdirs/usr/ports/editors/emacs-devel/work-full/emacs-e511b9d/src/temacs -Q Breakpoint 3, syms_of_threads () at thread.c:1098 1098 defsubr (&Smake_thread); (gdb) p &main_thread $1 = (struct thread_state *) 0x8554d0c (gdb) disas syms_of_threads Dump of assembler code for function syms_of_threads: 0x08249840 <+0>: push %ebp 0x08249841 <+1>: mov %esp,%ebp 0x08249843 <+3>: push %esi 0x08249844 <+4>: push $0x8506838 0x08249849 <+9>: call 0x8202e90 0x0824984e <+14>: add $0x4,%esp => 0x08249851 <+17>: push $0x8506898 0x08249856 <+22>: call 0x8202e90 0x0824985b <+27>: add $0x4,%esp 0x0824985e <+30>: push $0x8506858 0x08249863 <+35>: call 0x8202e90 0x08249868 <+40>: add $0x4,%esp 0x0824986b <+43>: push $0x85068b8 0x08249870 <+48>: call 0x8202e90 0x08249875 <+53>: add $0x4,%esp 0x08249878 <+56>: push $0x85068d8 0x0824987d <+61>: call 0x8202e90 0x08249882 <+66>: add $0x4,%esp 0x08249885 <+69>: push $0x85068f8 0x0824988a <+74>: call 0x8202e90 0x0824988f <+79>: add $0x4,%esp 0x08249892 <+82>: push $0x8506918 0x08249897 <+87>: call 0x8202e90 0x0824989c <+92>: add $0x4,%esp 0x0824989f <+95>: push $0x8506938 0x082498a4 <+100>: call 0x8202e90 0x082498a9 <+105>: add $0x4,%esp 0x082498ac <+108>: push $0x8506878 0x082498b1 <+113>: call 0x8202e90 0x082498b6 <+118>: add $0x4,%esp 0x082498b9 <+121>: push $0x8506958 0x082498be <+126>: call 0x8202e90 0x082498c3 <+131>: add $0x4,%esp 0x082498c6 <+134>: push $0x8506978 0x082498cb <+139>: call 0x8202e90 0x082498d0 <+144>: add $0x4,%esp 0x082498d3 <+147>: push $0x8506998 0x082498d8 <+152>: call 0x8202e90 0x082498dd <+157>: add $0x4,%esp --Type for more, q to quit, c to continue without paging-- 0x082498e0 <+160>: push $0x85069b8 0x082498e5 <+165>: call 0x8202e90 0x082498ea <+170>: add $0x4,%esp 0x082498ed <+173>: push $0x85069d8 0x082498f2 <+178>: call 0x8202e90 0x082498f7 <+183>: add $0x4,%esp 0x082498fa <+186>: push $0x85069f8 0x082498ff <+191>: call 0x8202e90 0x08249904 <+196>: add $0x4,%esp 0x08249907 <+199>: push $0x8506a18 0x0824990c <+204>: call 0x8202e90 0x08249911 <+209>: add $0x4,%esp 0x08249914 <+212>: push $0x8506a38 0x08249919 <+217>: call 0x8202e90 0x0824991e <+222>: add $0x4,%esp 0x08249921 <+225>: push $0x8506a58 0x08249926 <+230>: call 0x8202e90 0x0824992b <+235>: add $0x4,%esp 0x0824992e <+238>: push $0x8506a78 0x08249933 <+243>: call 0x8202e90 0x08249938 <+248>: add $0x4,%esp 0x0824993b <+251>: push $0x8554dc0 0x08249940 <+256>: call 0x81bad60 0x08249945 <+261>: add $0x4,%esp 0x08249948 <+264>: movl $0x0,0x8554dc0 0x08249952 <+274>: push $0xe 0x08249954 <+276>: push $0x82ab272 0x08249959 <+281>: call 0x8202460 0x0824995e <+286>: add $0x8,%esp 0x08249961 <+289>: mov %eax,%esi 0x08249963 <+291>: push $0xd 0x08249965 <+293>: push $0x82ab281 0x0824996a <+298>: call 0x8202460 0x0824996f <+303>: add $0x8,%esp 0x08249972 <+306>: push $0x0 0x08249974 <+308>: push %eax 0x08249975 <+309>: push %esi 0x08249976 <+310>: call 0x81c0930 0x0824997b <+315>: add $0xc,%esp 0x0824997e <+318>: push $0x7 --Type for more, q to quit, c to continue without paging-- 0x08249980 <+320>: push $0x82ab691 0x08249985 <+325>: call 0x8202460 0x0824998a <+330>: add $0x8,%esp 0x0824998d <+333>: push $0x0 0x0824998f <+335>: push %eax 0x08249990 <+336>: call 0x81e4ad0 0x08249995 <+341>: add $0x8,%esp 0x08249998 <+344>: push $0x8557a54 0x0824999d <+349>: push $0x82ab28f 0x082499a2 <+354>: push $0x8554dc8 0x082499a7 <+359>: call 0x82030f0 0x082499ac <+364>: add $0xc,%esp 0x082499af <+367>: cmpb $0x0,0x8557ef0 0x082499b6 <+374>: je 0x82499c4 0x082499b8 <+376>: movl $0x8554d11,0x8557a54 0x082499c2 <+386>: jmp 0x82499e9 0x082499c4 <+388>: mov $0x8554d14,%eax 0x082499c9 <+393>: test $0x7,%al 0x082499cb <+395>: jne 0x82499ec 0x082499cd <+397>: movl $0x8554d11,0x8557a54 0x082499d7 <+407>: mov $0x7f000000,%eax 0x082499dc <+412>: and 0x8554d0c,%eax 0x082499e2 <+418>: cmp $0x54000000,%eax 0x082499e7 <+423>: jne 0x8249a00 0x082499e9 <+425>: pop %esi 0x082499ea <+426>: pop %ebp 0x082499eb <+427>: ret 0x082499ec <+428>: push $0x492 0x082499f1 <+433>: push $0x828071a 0x082499f6 <+438>: push $0x8280b68 0x082499fb <+443>: call 0x81b6b50 0x08249a00 <+448>: push $0x46d 0x08249a05 <+453>: push $0x82ab73e 0x08249a0a <+458>: push $0x82ab29b 0x08249a0f <+463>: call 0x81b6b50 End of assembler dump. (gdb) p &Vmain_thread No symbol "Vmain_thread" in current context. (gdb) quit A debugging session is active. Inferior 1 [process 86154] will be killed. Quit anyway? (y or n) y root@11i386-default:/wrkdirs/usr/ports/editors/emacs-devel/work-full/emacs-e511b9d/src # CC --version FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0) Target: i386-unknown-freebsd11.2 Thread model: posix InstalledDir: /usr/bin > Also, please investigate what the macro GCALIGNED_STRUCT expands to. You can use 'gcc -E' to do that. I'll get back to you with this soon.