Closed voidanix closed 2 years ago
Have you tried gcc and/or older clang releases?
GCC works fine, did not try with older clang releases (but I think the crash is reproducible on 12.0.0)
@TheAssassin as discussed on IRC, here is the patch that makes things not crash:
diff --git a/src/engine/menus.cpp b/src/engine/menus.cpp
index faa3f08..79ea74a 100644
--- a/src/engine/menus.cpp
+++ b/src/engine/menus.cpp
@@ -713,7 +713,7 @@ COMMAND(0, ui_body, "esse");
COMMAND(0, ui_bar, "iibb");
COMMAND(0, ui_fill, "ii");
COMMAND(0, ui_outline, "iiii");
-COMMAND(0, ui_background, "bgbgii");
+COMMAND(0, ui_background, "bfbfii");
COMMAND(0, ui_strut, "fi");
COMMAND(0, ui_spring, "i");
COMMAND(0, ui_visible, "e");
The magic letters come from the specifiers of the arguments in the ui_background
function, I think:
void ui_background(int *colour1, float *blend1, int *colour2, float *blend2, int *skinborder, int *levels)
Trying to replace with f
one of the floats individually still leads to the crash.
EDIT: not dereferencing one of the floats also seems to work:
diff --git a/src/engine/menus.cpp b/src/engine/menus.cpp
index faa3f08..277aff1 100644
--- a/src/engine/menus.cpp
+++ b/src/engine/menus.cpp
@@ -369,9 +369,9 @@ void ui_outline(int *colour, int *levels, int *offsetx, int *offsety)
if(cgui) cgui->outline(*colour, *levels, 0, *offsetx, *offsety);
}
-void ui_background(int *colour1, float *blend1, int *colour2, float *blend2, int *skinborder, int *levels)
+void ui_background(int *colour1, float *blend1, int *colour2, float blend2, int *skinborder, int *levels)
{
- if(cgui) cgui->background(*colour1, *blend1, *colour2, *blend2, *skinborder!=0, *levels);
+ if(cgui) cgui->background(*colour1, *blend1, *colour2, blend2, *skinborder!=0, *levels);
}
void ui_strut(float *strut, int *alt)
I don't get any crash or player preview issues on clang 11 (the current one in Debian stable).
After spinning up multiple containers/VMs, this one looks (to me) like a regression in clang 13.0.0 specifically.
Both clang main and <=12 work just fine so I am really out of ideas as to what is going on.
I am probably going to keep the issue open until 13.0.1 comes out (if it fixes the issue) so we could probably get more feedback when on 13.0.0.
Fascinating. I'll try to reproduce this on some Ubuntu bionic later, clang is compiling already.
For the record, reproducible only with clang 13.0.0. I'd also say it's a compiler bug of some kind. I don't think it's worth spending more time on debugging. Please avoid 13.0.0 specifically.
First seen in: master
Observation: when compiled with clang, the player preview in the menu is not rendered and the game crashes when pressing either the "play offline/online" buttons, OTOH the build works fine without the
Release
build type (and consequently the flags it applies).Funnily enough, the same issue seems to affect RE2 (for which I have ported BN's cmake system) and it crashes immediatly after startup when it tries to display the player preview/model.
How to reproduce:
Run the game and see the absent player preview.
Press the "Offline practice" or "Play online" buttons for the game to crash
BN trace:
```shell (gdb) r Starting program: /bn/bin/blue-nebula_linux [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7ffff6f25640 (LWP 14607)] [New Thread 0x7fffe11fa640 (LWP 14614)] [New Thread 0x7fffe09f9640 (LWP 14615)] [New Thread 0x7fffd3fff640 (LWP 14616)] [New Thread 0x7fffd37fe640 (LWP 14617)] [New Thread 0x7fffd2ffd640 (LWP 14618)] [New Thread 0x7fffd27fc640 (LWP 14619)] [New Thread 0x7fffd1ffb640 (LWP 14620)] [New Thread 0x7fffd17fa640 (LWP 14621)] [Thread 0x7fffd17fa640 (LWP 14621) exited] [New Thread 0x7fffd17fa640 (LWP 14622)] [Thread 0x7fffd17fa640 (LWP 14622) exited] [New Thread 0x7fffd0c55640 (LWP 14624)] [New Thread 0x7fffd17fa640 (LWP 14625)] [Thread 0x7fffd17fa640 (LWP 14625) exited] [New Thread 0x7fffd17fa640 (LWP 14626)] [New Thread 0x7fffb7cff640 (LWP 14627)] libpng warning: iCCP: known incorrect sRGB profile Thread 1 "blue-nebula_lin" received signal SIGSEGV, Segmentation fault. 0x00000000004fa915 in ui_background (colour1=0x7fffffff8030, blend1=0x7fffffff8040, colour2=RE2 trace (just in case it ends up being related):
```shell (gdb) r Starting program: /testeclipse/bin/blue-nebula_linux [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". 2021-12-12 19:42.13 Checking working directory: /testeclipse 2021-12-12 19:42.13 Added package: data/ [New Thread 0x7ffff6f14640 (LWP 15846)] [New Thread 0x7fffe11e9640 (LWP 15849)] [New Thread 0x7fffe09e8640 (LWP 15850)] [New Thread 0x7fffdbfff640 (LWP 15851)] [New Thread 0x7fffdb7fe640 (LWP 15852)] [New Thread 0x7fffdaffd640 (LWP 15853)] [New Thread 0x7fffda7fc640 (LWP 15854)] [New Thread 0x7fffd9ffb640 (LWP 15855)] [New Thread 0x7fffd97fa640 (LWP 15858)] [Thread 0x7fffd97fa640 (LWP 15858) exited] [New Thread 0x7fffd97fa640 (LWP 15859)] [Thread 0x7fffd97fa640 (LWP 15859) exited] [New Thread 0x7fffd8c33640 (LWP 15861)] [New Thread 0x7fffd97fa640 (LWP 15862)] [Thread 0x7fffd97fa640 (LWP 15862) exited] [New Thread 0x7fffd97fa640 (LWP 15863)] [New Thread 0x7fffb7dff640 (LWP 15864)] free(): invalid pointer Thread 1 "blue-nebula_lin" received signal SIGABRT, Aborted. 0x00007ffff787a4ec in __pthread_kill_implementation () from /lib64/libc.so.6 (gdb) where #0 0x00007ffff787a4ec in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x00007ffff782d696 in raise () from /lib64/libc.so.6 #2 0x00007ffff78177f3 in abort () from /lib64/libc.so.6 #3 0x00007ffff786e627 in __libc_message () from /lib64/libc.so.6 #4 0x00007ffff788442c in malloc_printerr () from /lib64/libc.so.6 #5 0x00007ffff7885d3c in _int_free () from /lib64/libc.so.6 #6 0x00007ffff78887c5 in free () from /lib64/libc.so.6 #7 0x0000000000516415 in freearg (v=...) at engine/command.cpp:101 #8 freeargs (args=0x7fffffffc1a0, oldnum=@0x7fffffffc144: 2, newnum=-2) at engine/command.cpp:101 #9 runcode (code=0x85c8f3c, result=...) at engine/command.cpp:3063 #10 0x000000000051a337 in execute ( p=p@entry=0x855e5b0 "iqmdir \"actors/player\"\n\nexec \"actors/player/ragdoll.cfg\"\n\niqmtag hand.R tag_weapon 0.1 -0.9 0.1 -90 0 -90\niqmtag ribs tag_bjet 0 0.4 2\niqmtag shin.L.02 tag_ljet 0 -1.6 1.6\niqmtag shin.R.02 tag_rjet 0 "...) at engine/command.cpp:3394 #11 0x000000000051ad55 in execfile (cfgfile=0x8552160 "actors/player/player.cfg", msg=I initially saw this bug a few months ago but just blamed the compiler being too new (clang-13.0.0-rc1), but with stable clang 13.0.0 the issue persists; a friend of mine also told me that on OpenBSD the issue does not seem exist.
I searched the issue list and checked that this is not a duplicate :white_check_mark: I tried to rename my config.cfg, and the problem also occurs with default settings :white_check_mark: