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

Compiler may fail with "Bad kind" diagnostic when using --neon and unaligned data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-7623
    • Hide
      ARM_18.12.0.LTS
      ARM_20.2.0.LTS
      Show
      ARM_18.12.0.LTS ARM_20.2.0.LTS
    • Hide
      ARM_18.12.7.LTS*
      ARM_20.2.2.LTS*
      Show
      ARM_18.12.7.LTS* ARM_20.2.2.LTS*
    • default
    • Hide
      Add "#pragma UNROLL(1)" (up to UNROLL(4), but definitely not UNROLL(8)) to the for-loop in ComputeChecksum().

      Or, compile at -o1 or less, or don't use --neon.
      Show
      Add "#pragma UNROLL(1)" (up to UNROLL(4), but definitely not UNROLL(8)) to the for-loop in ComputeChecksum(). Or, compile at -o1 or less, or don't use --neon.
    • Hide
      When compiling with '-mv7a8 --neon' and optimisation, the compiler will try to vectorise data accesses to take advantage of the Neon capabilities. If it creates an unaligned access of more than 32 bits, the compiler may abort with the one-line diagnostic "TP>> internal error: Bad kind: TYPE::elem_type()".

      In this particular test case, the compiler is making a 64-bit vector from chars that start at an offset in a struct, by unrolling a loop that operates on chars. The solution is to avoid making vectors more than 32 bits, by controlling the unroll amount, via the UNROLL pragma or the optimisation level.
      Show
      When compiling with '-mv7a8 --neon' and optimisation, the compiler will try to vectorise data accesses to take advantage of the Neon capabilities. If it creates an unaligned access of more than 32 bits, the compiler may abort with the one-line diagnostic "TP>> internal error: Bad kind: TYPE::elem_type()". In this particular test case, the compiler is making a 64-bit vector from chars that start at an offset in a struct, by unrolling a loop that operates on chars. The solution is to avoid making vectors more than 32 bits, by controlling the unroll amount, via the UNROLL pragma or the optimisation level.

      Use the attached files ...

      % armcl -@options.txt --diag_suppress=179 try1.cpp
      TP>> internal error: Bad kind:  TYPE::elem_type()
      
      >> Compilation failure
      

      One workaround is to use --opt_level=2 or lower.

      The forum customer originally reported the problem against version 17.9.0.STS. That version fails with a different diagnostic.

      % armcl -@options.txt --diag_suppress=179 try1.cpp
      >> try1.cpp, line 53340: INTERNAL ERROR: no match for SCONV
      
      
      This may be a serious problem.  Please contact customer support with a
      description of this problem and a sample of the source files that caused this
      INTERNAL ERROR message to appear.
      
      Cannot continue compilation - ABORTING!
      
      
      >> Compilation failure
      

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

              Created:
              Updated:
              Resolved: