ZScript compiler crashes out with complex dynarray access

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
ZZYZX
 
 
Posts: 1384
Joined: Sun Oct 14, 2012 1:43 am
Location: Ukraine
Contact:

ZScript compiler crashes out with complex dynarray access

Post by ZZYZX »

I started writing yet another weird project and it broke in the most unexpected place.
This function crashes compiler while initializing ZScript files (attempt to read from 0000000000000068):

Code: Select all

    void SetFrame(int index)
    {
        for (int i = 0; i < triangles.Size(); i++)
        {
            triangles[i].v1 = frames[index].vertices[triangles[i].iv1];
            triangles[i].v2 = frames[index].vertices[triangles[i].iv2];
            triangles[i].v3 = frames[index].vertices[triangles[i].iv3];
        }
    }
(it's in zscript.txt, in the attached pk3)
If changed to this:

Code: Select all

    void SetFrame(int index)
    {
        C3DFrame frame = frames[index];
        for (int i = 0; i < triangles.Size(); i++)
        {
            C3DTriangle triangle = triangles[i];
            triangle.v1 = frame.vertices[triangle.iv1];
            triangle.v2 = frame.vertices[triangle.iv2];
            triangle.v3 = frame.vertices[triangle.iv3];
        }
    }
It compiles and functions as expected.
Attachments
CrashReport.zip
(16.8 KiB) Downloaded 21 times
ModelCollisionBork.pk3
(33.03 KiB) Downloaded 23 times
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: ZScript compiler crashes out with complex dynarray acces

Post by _mental_ »

It's a known limitation at the moment. It was already reported at least once here.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript compiler crashes out with complex dynarray acces

Post by Major Cooke »

So does this commit fix the issue?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: ZScript compiler crashes out with complex dynarray acces

Post by _mental_ »

No, it’s for different issue.
Post Reply

Return to “Closed Bugs [GZDoom]”