ZScript Multiple return values crash

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
RaveYard
Posts: 186
Joined: Fri Apr 12, 2013 10:51 am

ZScript Multiple return values crash

Post by RaveYard »

summon crasher twice to cause crash in GZDoom.

Code: Select all

class Dummy
{
	String text;

	static Dummy Create(String s)
	{
		let t = new('Dummy');
		t.text = s;
		return t;
	}
}

class Crasher : Actor
{
	// This one is fine
	static Dummy, Dummy MakePair()
	{
		return Dummy.Create("First"), Dummy.Create("Second");
	}

	// Something goes horribly wrong when this is used
	static Dummy, Dummy ReturnMagic()
	{
		return MakePair();
	}

	Dummy a, b;
	
	States
	{
		Spawn:
			TNT1 A 0 nodelay {
				[a, b] = ReturnMagic();

				Console.Printf("A: %p, B: %p", a, b);
			}
			TNT1 A 0 {
				// Crashes only when split into another function
				Console.Printf("%s", b ? b.text : "(B is empty)");
			}
			stop;
	}
}
It once crashed durring startup, but I can't reproduce that. Might be unrelated.

Return to “Bugs [GZDoom]”