You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit addresses two critical issues with global struct arrays:
1. Global struct arrays were missing the is_global flag, causing them to
be treated as local variables during code generation. This led to
segmentation faults when accessing them at runtime since they were
incorrectly loaded from the stack pointer (sp) instead of the global
pointer (gp).
2. Global struct array initialization values were being parsed but
ignored. The parser was only consuming the tokens without generating
the necessary OP_load_constant instructions to initialize the values
at runtime.
This fixes the test case where `struct point gpts1[] = { {3, 4} }` would
return 0 instead of the expected 7 when accessing gpts1[0].x+gpts1[0].y.
0 commit comments