Global instance of structure is unexpectedly allocated into an initialized section

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Not Prioritized

      The attached C++ file has these lines ...

      struct tag_name
      {
          int field;
          int array[100];
      };
      
      __attribute__((section("section_name")))
      struct tag_name instance;
      

      The customer expects section_name to be uninitialized. Build it and inspect the resulting assembly code ...

      % tiarmclang -S cppfile.cpp
      
      % findstr section_name cppfile.s
              .section        section_name,"aw",%progbits
      

      Because of %progbits, and not %nobits, section_name is initialized.

      Because it is initialized, when the executable file is converted to TI-TXT format, a large number of 0's is emitted for the memory where this section is allocated.

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

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-5825 - Global instance of structure is une...
                SYNCHRONIZED
                • Last Sync Date: