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!

ZScript Multiple return values crash

Postby RaveYard » Sat Mar 13, 2021 8:17 am

summon crasher twice to cause crash in GZDoom.

Code: Select allExpand view
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.
RaveYard
 
Joined: 12 Apr 2013

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests