Menu

#83 Array inside structure generates invalid ArrayGet wrapper

1.04
closed
nobody
bug (5)
2022-12-29
2020-07-07
Paril
No

Arrays inside of structs do not generate proper ArrayGet/Set wrappers. This only happens when extensions are off (obviously), but prevents arrays from working at all, and will always throw "out of bounds" errors.

Here's QC to reproduce:

entity world;

struct nested_struct
{
    int x, y;
    float    array[10];
};

struct test_struct
{
    float    array[17];
    float a, b;
    nested_struct strect;
};

.test_struct    stroct;
.float tempst[10];

void() test_func =
{
    float x = 5;
    world.stroct.array[x] = 5f;
    world.stroct.strect.array[x] = 5f;
    world.tempst[x] = 5f;
};

Two functions will be made here, ArrayGet*stroct and ArrayGet*tempst. Note that ArrayGet*stroct's bytecode assumes it's a 1-length array, nor does it generate two functions for the two different arrays being referenced.

(There's also a secondary error that will occur if you comment out the array in nested_struct, inwhich the name of the struct becomes garbage in the error message).

This is a huge breaker for what I'm trying to do :(

Discussion

  • eukara

    eukara - 2022-03-06
    • status: open --> closed
     
  • eukara

    eukara - 2022-03-06

    This appears to be fixed. I tried it on its own as well as incorporating into a server progs and the code compiles and runs without issue.

     
  • Xylemon

    Xylemon - 2022-12-29
     

Log in to post a comment.

MongoDB Logo MongoDB