Compiler changes struct definition from uninitialized to initialized when --opt_level changes from 1 to 2

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • Code Generation Tools
    • CODEGEN-14182
    • Hide
      C7000_6.x.0.LTS*
      MSP430_20.2.0.LTS
      C7000_2.1.0.LTS
      C6000_8.3.1
      MSP430_21.6.0.LTS
      C2000_21.6.0.LTS
      PRU_2.3.0
      C7000_3.1.0.LTS
      ARM_20.2.0.LTS
      C7000_4.1.0.LTS
      C2000_20.2.0.LTS
      C7000_1.4.0.LTS
      C6000_8.6.0.LTS*
      C6000_8.5.0.LTS
      PRU_2.4.0*
      C7000_6.1.0.STS
      Show
      C7000_6.x.0.LTS* MSP430_20.2.0.LTS C7000_2.1.0.LTS C6000_8.3.1 MSP430_21.6.0.LTS C2000_21.6.0.LTS PRU_2.3.0 C7000_3.1.0.LTS ARM_20.2.0.LTS C7000_4.1.0.LTS C2000_20.2.0.LTS C7000_1.4.0.LTS C6000_8.6.0.LTS* C6000_8.5.0.LTS PRU_2.4.0* C7000_6.1.0.STS
    • default

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

      #pragma SET_DATA_SECTION(".appblk")
          const AppBlk appBlock{(0xAA551234U),
                                   (uint32_t)&_app_start,
                                   (uint32_t)&_app_end,
                                   (uint32_t)&_c_int00,
                                   (uint32_t)&_appblk_crc,
                                   (uint32_t)&_app_crc};
      #pragma SET_DATA_SECTION()
      

      The following commands build it with --opt_level set to 1 and 2, and compare how the section .appblk is defined.

      % armcl -@options.txt -s --opt_level=1 file.cpp & findstr appblk file.asm | findstr sect
      appBlock:       .usect  ".appblk",128,4
      
      % armcl -@options.txt -s --opt_level=2 file.cpp & findstr appblk file.asm | findstr sect
              .sect   ".appblk"
      

      When built with --opt_level=1 or lower, the section .appblk is uninitialized. When built with --opt_level=2 or higher, the section .appblk is initialized.

      Code in the customer's linker command file presumes .appblk is initialized. When .appblk is unintialized, the linker issues the diagnostic ...

      warning #99922: Test.out: accessing the raw data of section ".appblk" which is uninitialized according to its section attributes; changes to raw data may be lost
      

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

              Created:
              Updated:

                Connection: Intermediate to External PROD System
                EXTSYNC-5670 - Compiler changes struct definition ...
                SYNCHRONIZED
                • Last Sync Date: