This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Is this known bug of compiler?

Part Number: TMS320F28375D


Tool/software: TI C/C++ Compiler

I want to output CLARAM data to EMIF2 data.
So I wrote CLA C-source code as below.

#define WRITE_SIZE (31)
interrupt   void   Cla1Task7(void) {
   int16 s16_i;
   int16 *s_ptr;
   volatile int16 *d_ptr;

   s_ptr = (int16 *)(&(claram.top));
   d_ptr = (volatile int16 *)EMIF2_ADDRESS;
   for (s16_i = 0; s16_i < WRITE_SIZE; s16_i++) {
       *d_ptr++ = *s_ptr++;
   }
}

This code copy only 4 data instead of 31 data i expect.
I change the number of WRITE_SIZE, then I got various result.


WRITE_SIZE=32,29,28 is OK (Full data copied)
WIRTE_SIZE=31(is only 4data),30,33,27(is only 3data) is NG.

I check the assembler code, and find the reason of this error maybe.

[NG case]
In this case, assembler code consists of N times loop every 3 data move.And 3rd data move code and compare for end of loop were mixed as below.

        MCMP32    MR2,MR1
        MMOVZ16   MR0,*MAR1[#1]++
        MMOV16    *MAR0[#1]++,MR0
        MMOV16    @__cla_scratchpad_start,MAR0
        MNOP
        MNOP
        MMOVZ16   MR0,@__cla_scratchpad_start
        MBCNDD    $C$L1,NEQ

The result of MCPM32 is used MBCNDD. But MMOVZ16 after MCPM32 has a posibillity of change a status flag. If CLARAM data is 0, then Z flag is set and MBCNDD make a mistake.

[OK case]
In this case, assembler code consists of N times loop every 2 data move. And 2nd data move code is divided from code end of loop.

        MMOVIZ    MR2,#0
        MMOVZ16   MR0,*MAR1[#1]++
        MCMP32    MR2,MR1
        MMOV16    *MAR0[#1]++,MR0
        MMOV16    @__cla_scratchpad_start,MAR0
        MNOP
        MNOP
        MMOVZ16   MR0,@__cla_scratchpad_start
        MBCNDD    $C$L1,NEQ

There are no code changing a status flag between MCMP32 and MBCNDD.So this code runs normally.

I used TI compiler v6.2.8 and optimize option is -O3 --opt_for_speed=5.

Is this known bug? Should i use newest compiler?

  • I need a test case which allows me to generate the same assembly code you see in the NG case.  Once I can do that, I will submit a bug report to the compiler development team.  For the source file which contains the function Cla1Task7, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • I mention that OK case also has a posibillity of change a status flag. MMOVZ16 before MBCNDD change Z flag if MAR0 is 0. But in this case, MAR0 starts EMIF2_ADDRESS and incriment, so MAR0 is not 0 always.
  • I tryed "insert file" many times, but .txt file is attached as an media file.So paste below.

    It's very simple code. It can't run, but creates same assemble code as NG case.Please check this.

    [cla1_task.pp]


    short cla_write_emif2[(31)];

    #pragma CODE_SECTION(Cla1Task7, "Cla1Prog");

    //********************************************************************
    // Cla1Task7
    //********************************************************************
    interrupt   void    Cla1Task7(void) {
        short s16_i;
        short *s_ptr;
        volatile short *d_ptr;

        s_ptr = (short *)(&(cla_write_emif2[0]));
        d_ptr = (volatile short *)(0x2380);
        for (s16_i = 0; s16_i < (31); s16_i++) {
            *d_ptr++ = *s_ptr++;
        }
    }
    //--------------------------------------------------------------------

    [Compiler version]

    v6.2.8

    [Compiler Options Used]

    **** Build of configuration Debug for project CLAtest ****

    "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k source/cla1_task.obj
    'Building file: ../source/cla1_task.cla'
    'Invoking: C2000 Compiler'
    "C:/ti/ccsv6/tools/compiler/c2000_6.2.8/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -O3 --opt_for_speed=5 -g --preproc_with_compile --preproc_with_comment --diag_warning=225 --display_error_number --diag_wrap=off -k --c_src_interlist --obj_directory="source"  "../source/cla1_task.cla"
    "../source/cla1_task.cla", line 17: warning #1107-D: conversion from integer to smaller pointer
    'Finished building: ../source/cla1_task.cla'
    ' '

    **** Build Finished ****

  • Thank you for the test case.  I can reproduce the problem output.

    However, this problem is fixed in later releases.  I tried version 18.1.4.LTS.   While I cannot run the code to be certain, I am very confident the problem has been fixed.  Is it practical for you to upgrade to a later release?  

    I apologize for failing to notice that, in your first post, you said you use version 6.2.8.  This version is about 4.5 years old.  The 6.2.x series of releases is no longer supported.  

    Thanks and regards,

    -George

  • Is it practical for you to upgrade to a later release of the compiler?

    Thanks and regards,

    -George

  • Since it has been a while, I presume you have resolved your problem.  I'd appreciate hearing how you resolved it.

    Thanks and regards,

    -George