Compiler uses wrong NOP instruction encoding when filling gap caused by alignment before a loop

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • Code Generation Tools
    • CODEGEN-14666
    • Hide
      ARMCLANG_2.1.0.LTS
      ARMCLANG_4.0.0.LTS
      ARMCLANG_3.2.0.LTS
      ARMCLANG_1.3.0.LTS
      Show
      ARMCLANG_2.1.0.LTS ARMCLANG_4.0.0.LTS ARMCLANG_3.2.0.LTS ARMCLANG_1.3.0.LTS
    • Hide
      ARMCLANG_4.0.5.LTS*
      ARMCLANG_3.2.4.LTS*
      Show
      ARMCLANG_4.0.5.LTS* ARMCLANG_3.2.4.LTS*
    • default

      Extract the attached test case to an empty directory. The source file int_handler.c has these lines ...

      void ISR_Init (void)
      {
          for(u_32 i = 0; i < ISR_COUNT; i++)
          {
              isr_fnc_table [i] = (u_32) ISR_default_function;
          }
      }
      

      Build and disassemble ...

      % tiarmclang @options.txt int_handler.c
      % tiarmobjdump --source int_handler.o > dis.txt
      

      Inspect the disassembly to see ...

            14: f2c0 0200    	movt	r2, #0x0
            18: f000 e320    blx	0x40065c <ISR_Init+0x40065c> @ imm = #0x400640
            1c: f000 e320    	blx	0x400660 <ISR_Init+0x400660> @ imm = #0x400640
            20: 180b         	adds	r3, r1, r0
      

      The instructions at offsets 0x14 and 0x20 are correct. Offset 0x20 is the start of a loop. The compiler issues a .p2align directive to align that address. The instructions at offsets 0x18 and 0x1c fill the alignment gap. They should be thumb2 mode NOP instructions. But instead, they are arm mode NOP instructions.

            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-6073 - Compiler uses wrong NOP instruction...
                SYNCHRONIZED
                • Last Sync Date: