Exponents via ** Cause Crash on GZDoom Load

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Kom
Posts: 10
Joined: Sun May 04, 2008 2:18 pm
Location: Arkansas, USA
Contact:

Exponents via ** Cause Crash on GZDoom Load

Post by Kom »

Was looking for a way to calculate exponents with double values and came across this: https://mantis.zdoom.org/view.php?id=513

I tried using this syntax but noticed gzdoom 3.1.0 stable and the latest 3.2.0 pre-495-g7195af4 beta would both crash on load.

Code: Select all

class TestPuff : BulletPuff {
	
	double dist;
	
	States {
		Spawn:
			TNT1 A 0 NoDelay {
				dist = 2.0 ** GetDistance(true);
			}
	}
}
Attachments
exponent_crash.pk3
(274 Bytes) Downloaded 30 times
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Exponents via ** Cause Crash on GZDoom Load

Post by _mental_ »

Am I right that call to FxBinary::Promote() is missing at the end of FxPow::Resolve() function?
Most likely this is the only reason for nullptr value of FxPow::ValueType.

As a side note: next time it will be nice if example won't contain infinite loops.
dpJudas
 
 
Posts: 3040
Joined: Sat May 28, 2016 1:01 pm

Re: Exponents via ** Cause Crash on GZDoom Load

Post by dpJudas »

I pushed a fix for this bug.

I fixed it by setting the ValueType to TypeFloat64 directly instead of calling Promote. Mainly because the code above already ensures that the value type can only be a float at this point. Calling Promote would have produced the same outcome, but that would have implied this code could have situations where one of the operands wasn't already a float.
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Exponents via ** Cause Crash on GZDoom Load

Post by Gez »

_mental_ wrote:As a side note: next time it will be nice if example won't contain infinite loops.
There's no "loop" instruction, so shouldn't the next state be 0 and the actor get destroyed?
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Exponents via ** Cause Crash on GZDoom Load

Post by Xaser »

It's missing a Stop directive, so it falls back to the "go to the next state in the list" behavior. The line of code that handles this has a fallback where if it's the very last state in the list, it goes to the first state. Unfortunately, in the posted example, the last state and the first state are one and the same, and the duration is zero. Welcome to Loopville, population: infinity.
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Exponents via ** Cause Crash on GZDoom Load

Post by Gez »

For some reason I assumed the fallback was "just stop existing, you buggy piece of [c|t]rash".
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Exponents via ** Cause Crash on GZDoom Load

Post by Xaser »

Beats me why it is what it is, though it's amusing forgetting to put a Stop at the end of a projectile Death state and watching it blink back into existence for all eternity. :P
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Exponents via ** Cause Crash on GZDoom Load

Post by Graf Zahl »

This is a remnant of how the format came to be. Back in 2003 it made sense being able to omit the 'stop' for simple decorations.
Post Reply

Return to “Closed Bugs [GZDoom]”