-
Enhancement
-
Resolution: Unresolved
-
Medium
-
Code Generation Tools
-
CODEGEN-11632
-
C2000_22.6.0.LTS
-
C2000_NEXT*
-
default
The attached file has these lines ...
void fxn() { Global.var = (tsArray) { .array = {100, 101, 102, 103, 104} }; }
Build it ...
cl2000 -s -o --unified_memory file.c
Inspect file.asm to see that an array of values is created in .const. That array is copied into a temporary array on the stack, then the temporary array on the stack is copied to Global.var. This is inefficient. Eliminate the use of the temporary array on the stack.
In this cutdown test case, the inefficiency does not look that bad. In the customer use case, the array of values is very large. It overflowed the stack.