cmajor icon indicating copy to clipboard operation
cmajor copied to clipboard

Multi-dimensional arrays of structures (bug?)

Open sorenjakobsen opened this issue 9 months ago • 2 comments

There seems to be some kind of issue with multi-dimensional arrays. In the following code the line 'test[0][0].a = 1;' takes an extremely long time to execute (in vscode there is a long delay before the 'console' is displayed).

processor Test
{
    output event float out;

    struct TestStruct {
        int a;
        int[100] b;
    }

    TestStruct[100][100] test;

    void main()
    {
        test[0][0].a = 1;

        loop {
            advance();
        }
    }
}

sorenjakobsen avatar Mar 27 '25 22:03 sorenjakobsen

Hi, yes I can confirm I can reproduce this here. The time is being spent at compile time, optimising the generated code. We altered how the optimiser runs a little while back and I think this is a side effect. I'll look at getting a fix in place. Thanks for raising.

cesaref avatar Mar 28 '25 09:03 cesaref

Quick update - this dropped off my radar so i've not made any progress with it. Sorry about this, i'll get back onto it soon though...

cesaref avatar May 20 '25 09:05 cesaref