D4D SSG crash

Bugs that have been resolved.

Moderator: Graf Zahl

Locked
KaadmY

D4D SSG crash

Post by KaadmY »

When firing the Super Shotgun using the D4D mod, GZDoom crashes due to a failed assertion r.

Other people are having the same issue, but there haven't been any solutions as far as I can see.

Code: Select all

gzdoom: .../src/zscript/vmexec.h:61: static int VMExec_Checked::Exec(VMFrameStack*, const VMOP*, VMReturn*, int): Assertion `(unsigned)(a) < f->NumRegD' failed.

Code: Select all

#0  0x00007ffff30ff04f in raise () at /usr/lib/libc.so.6
#1  0x00007ffff310047a in abort () at /usr/lib/libc.so.6
#2  0x00007ffff30f7ea7 in __assert_fail_base () at /usr/lib/libc.so.6
#3  0x00007ffff30f7f52 in  () at /usr/lib/libc.so.6
#4  0x0000000000b98c76 in VMExec_Checked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) (stack=0x11ad070 <FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**)::stack>, pc=0x1f4fbf0, ret=0x0, numret=0) at .../src/zscript/vmexec.h:61
#5  0x0000000000bb7037 in VMFrameStack::Call(VMFunction*, VMValue*, int, VMReturn*, int, VMException**) (this=0x11ad070 <FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**)::stack>, func=
    0x23b3510, params=0x7fffffffcb70, numparams=3, results=0x0, numresults=0, trap=0x0) at .../src/zscript/vmframe.cpp:392
#6  0x000000000086ea23 in FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**) (this=0x23ec0a0, self=0x24d6960, stateowner=0x2118e00, info=0x7fffffffcbf0, stateret=0x0)
    at .../src/info.cpp:95
#7  0x000000000093aef8 in DPSprite::SetState(FState*, bool) (this=0x28c0150, newstate=0x23ec0a0, pending=false) at .../stable/src/p_pspr.cpp:339
#8  0x000000000093ee8f in AF_A_Overlay(VMFrameStack*, VMValue*, int, VMReturn*, int) (stack=0x11ad070 <FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**)::stack>, param=0x2d48f40, numparam=5, ret=0x7fffffffcce0, numret=1) at .../src/p_pspr.cpp:1161
#9  0x0000000000b9ee75 in VMExec_Checked::Exec(VMFrameStack*, VMOP const*, VMReturn*, int) (stack=0x11ad070 <FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**)::stack>, pc=0x23473e4, ret=0x7fffffffd300, numret=1) at .../src/zscript/vmexec.h:496
#10 0x0000000000bb7037 in VMFrameStack::Call(VMFunction*, VMValue*, int, VMReturn*, int, VMException**) (this=0x11ad070 <FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**)::stack>, func=0x2381fe0, params=0x7fffffffd2d0, numparams=3, results=0x7fffffffd300, numresults=1, trap=0x0) at .../src/zscript/vmframe.cpp:392
#11 0x000000000086ea6d in FState::CallAction(AActor*, AActor*, FStateParamInfo*, FState**) (this=0x23eb588, self=0x24d6960, stateowner=0x2118e00, info=0x7fffffffd350, stateret=0x7fffffffd368)
    at .../src/info.cpp:101
#12 0x000000000093aef8 in DPSprite::SetState(FState*, bool) (this=0x28a2670, newstate=0x23eb588, pending=false) at .../src/p_pspr.cpp:339
#13 0x000000000093aa26 in P_SetPsprite(player_t*, PSPLayers, FState*, bool) (player=0x11a7cc0 <players>, id=PSP_WEAPON, state=0x23eb4e8, pending=false)
    at /home/kaadmy/software/gzdoom/stable/src/p_pspr.cpp:182
#14 0x000000000093b2e8 in P_FireWeapon(player_t*, FState*) (player=0x11a7cc0 <players>, state=0x23eb4e8) at .../src/p_pspr.cpp:451
#15 0x000000000093c427 in P_CheckWeaponFire(player_t*) (player=0x11a7cc0 <players>) at .../src/p_pspr.cpp:777
#16 0x0000000000940b27 in player_t::TickPSprites() (this=0x11a7cc0 <players>) at .../src/p_pspr.cpp:1410
#17 0x000000000098bea4 in P_PlayerThink(player_t*) (player=0x11a7cc0 <players>) at .../src/p_user.cpp:2647
#18 0x00000000009744ed in P_Ticker() () at .../src/p_tick.cpp:125
#19 0x000000000085363c in G_Ticker() () at .../src/g_game.cpp:1201
#20 0x0000000000824580 in TryRunTics() () at .../src/d_net.cpp:1945
#21 0x000000000081a890 in D_DoomLoop() () at .../src/d_main.cpp:1011
#22 0x000000000081e50d in D_DoomMain() () at .../src/d_main.cpp:2644
#23 0x00000000005cb032 in main(int, char**) (argc=3, argv=0x7fffffffea18) at .../src/posix/sdl/i_main.cpp:317
Using GZDoom 2.2.0 release tarball from https://codeload.github.com/coelckers/g ... .gz/g2.2.0 compiled from source, on Arch Linux.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: D4D SSG crash

Post by Graf Zahl »

Does this still happen with the latest version? The code in question has changed a lot since 2.2.0 and trying to track this down without first verifying that it still exists will only cost time.
Major Cooke
Developer
Developer
Posts: 240
Joined: Wed Mar 04, 2009 19:25

Re: D4D SSG crash

Post by Major Cooke »

On linux? Now this I have no idea about, and I'm afraid none of us (the devs of D4D) has it.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: D4D SSG crash

Post by Rachael »

If you're getting assert fails, try compiling a release build instead of a debug build (this can be set in cmake-gui). This will not solve the underlying problem (which is the reason why the assert is failing) but the asserts are more for a developer's benefit than a user's.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: D4D SSG crash

Post by Graf Zahl »

Major Cooke wrote:On linux? Now this I have no idea about, and I'm afraid none of us (the devs of D4D) has it.

The question was primarily aimed at the OP.
I have fixed several code generation errors while implementing ZScript, several of which were triggering asserts in debug code and the info here just isn't enough to go after it.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: D4D SSG crash

Post by Rachael »

@ Major Cooke: If it's an assert fail, try testing D4D in a debug build of ZDoom. Since you have a compiler environment you will actually be able to get the call stack that led up to the assertion failure. Doesn't matter Windows vs Linux. Although, like Graf said this issue may already be long fixed by now...
_mental_
Developer
Developer
Posts: 259
Joined: Sun Aug 07, 2011 13:36

Re: D4D SSG crash

Post by _mental_ »

Just out of curiosity I tried D4D 2.0.3 with a debug build g2.3pre-927-gb709db3, on macOS but it shouldn't matters.
A bunch of warnings were printed first and then it just crashed at codegen.cpp:8957 because WhenTrue was nullptr.
Spoiler: Callstack
Spoiler: Warnings
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: D4D SSG crash

Post by Graf Zahl »

In the crash case it would have been better to look what the current node's ScriptPosition contained. The fact that it crashed is one thing, but to check I need to know what code construct it crashed on.
_mental_
Developer
Developer
Posts: 259
Joined: Sun Aug 07, 2011 13:36

Re: D4D SSG crash

Post by _mental_ »

Here is the shortest code sample that crashes codegen:

Code: Select all

Actor Test
{
	States
	{
		Spawn:
		TNT1 A -1 NoDelay
		{
			if (GetCvar(sv_infiniteammo))
			{
				// empty
			}
			else
			{
				A_SpawnItemEx("Chainsaw");
			}
		}
		Stop
	}
}
If I got the code right the crash should be fixed like this.

There are still 23 errors in DECORATE that prevent loading of D4D but it doesn't crash at least.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: D4D SSG crash

Post by Graf Zahl »

Fixed the last one, but your PR didn't do it right, all that was missing was a null pointer check.
_mental_
Developer
Developer
Posts: 259
Joined: Sun Aug 07, 2011 13:36

Re: D4D SSG crash

Post by _mental_ »

Probably I'm missing something but initially I added the same check and it didn't work.
The decorate above always spawned a chainsaw no matter of sv_infiniteammo value.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: D4D SSG crash

Post by Graf Zahl »

Right. But that's an entirely different problem. Fixed by inverting the comparison and adjusting the backpatch calls.
Locked

Return to “Closed Bugs”