During initialization with a designated initializer, constant values are copied to a temp location on the stack, then to the final destination

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: Medium

      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.

            Assignee:
            TI User
            Reporter:
            TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-4210 - During initialization with a design...
                SYNCHRONIZED
                • Last Sync Date: