Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10084

tiarmclang: optimizer removes empty loops that don't have side effects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-6288
    • ARMCLANG_1.1.0.STS
    • ARMCLANG_2.1.0.LTS
    • default
    • Hide
      An _asm(" "); statement can be inserted into the body of an empty loop to mark the loop as having a side effect so that the optimizer will not removes it

      while (1) {
        _asm(" ");
      }
      Show
      An _asm(" "); statement can be inserted into the body of an empty loop to mark the loop as having a side effect so that the optimizer will not removes it while (1) {   _asm(" "); }

      When the following C code is compiled:

       

      void xdc_runtime_Startup_reset__I(void)
      {
          ti_sysbios_rom_cortexm_cc26xx_cc26x2v2_CC26xx_checkRevision__E();
      }
      
      void ti_sysbios_rom_cortexm_cc26xx_cc26x2v2_CC26xx_checkRevision__E()
      {
          if (*((UInt32 *)(268612608)) != 286529877) {
              ti_sysbios_rom_cortexm_cc26xx_cc26x2v2_CC26xx_badRomRevision__E();
          }
      }
      
      void ti_sysbios_rom_cortexm_cc26xx_cc26x2v2_CC26xx_badRomRevision__E() {
          /* Loop here forever if application is built with wrong version of ROM image */
          while(1) {
              ;
          }
      }
       
      

      The generated code for xdc_runtime_Startup_reset__I() becomes the following empty function:

      xdc_runtime_Startup_reset__I()
           000008fa: 4770 bx lr

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

              Created:
              Updated:
              Resolved: