Calling methods on a temporary string uses previous string

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!
User avatar
m8f
 
 
Posts: 1464
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)
Contact:

Calling methods on a temporary string uses previous string

Post by m8f »

Steps to reproduce:
Load this code as zscript.zs lump and start any Doom map with a zombie:

Code: Select all

version 4.14

class TestZombie : Zombieman replaces Zombieman
{
  override void BeginPlay()
  {
    //Console.Printf("I'll cause a VM abort".makeLower());

    Console.Printf("---------");
    Console.Printf("I'M OLD");
    Console.Printf("I'm new".makeLower());
  }
}
Code loads without errors and warnings (with `developer 2`).

Expected result:

Code: Select all

---------
I'M OLD                                                                                                             
i'm new
OR a syntax error on loading?

Actual result:

Code: Select all

---------
I'M OLD                                                                                                             
i'm old
Note: the first Console.Printf, if uncommented, causes a VM abort: `VM execution aborted: tried to read from address zero. In function parameter "self"`

Reproduces on GZDoom 4.14 and the latest master (commit f892a750b "Silence integer division warning").
Reproduces on Manjaro Linux, Linux 6.6.103-3-MANJARO on x86_64, and Debian GNU/Linux 13 (trixie), Linux 6.12.34+rpt-rpi-v8 on aarch64.
User avatar
phantombeta
Posts: 2180
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Calling methods on a temporary string uses previous string

Post by phantombeta »

This sounds like it's somehow getting the wrong register for the function call...
AFAIK string literals (i.e., constants) have to be copied over from a string constant to a string register to have a function called on them, something must be going wrong in that process...
User avatar
Jay0
 
 
Posts: 73
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: She/Her
Graphics Processor: nVidia with Vulkan support
Location: Brazil
Contact:

Re: Calling methods on a temporary string uses previous string

Post by Jay0 »

does it reproduce with the JIT off?
User avatar
m8f
 
 
Posts: 1464
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)
Contact:

Re: Calling methods on a temporary string uses previous string

Post by m8f »

Yes, it reproduces with both on and off:

Code: Select all

---------
I'M OLD
i'm old
]vm_jit
"vm_jit" is "false" (default: "true")

Code: Select all

---------
I'M OLD
i'm old
]vm_jit
"vm_jit" is "true" (default: "true")
Post Reply

Return to “Bugs [GZDoom]”