Function local static array allocated to .data section, and not .bss

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-9779
    • Hide
      ARMCLANG_2.0.0.STS
      ARMCLANG_1.3.1.LTS
      Show
      ARMCLANG_2.0.0.STS ARMCLANG_1.3.1.LTS
    • Hide
      ARMCLANG_2.1.0.LTS
      ARMCLANG_1.3.2.LTS*
      Show
      ARMCLANG_2.1.0.LTS ARMCLANG_1.3.2.LTS*
    • default

      The attached test case defines and uses a global array and a function local static array. Build it ...

      % tiarmclang -S file.c
      

      Inspect the assembly to see these lines for the definition of the static array ...

              .section        .data.fxn.static_array,"aw",%progbits
              .p2align        2
      fxn.static_array:
              .zero   400
      

      Compare that to the definition of the global array ...

              .comm   global_array,400,4
      

      It's in the common section, which eventually becomes .bss.

      The 400 bytes of zero in the .data section is a waste of memory. It would be better for the static array to be in .bss, and then get zero initialized by the startup code.

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

              Created:
              Updated:
              Resolved:

                Connection: Intermediate to External PROD System
                EXTSYNC-3305 - Function local static array allocat...
                SYNCHRONIZED
                • Last Sync Date: