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.

Compiler/TMS320C28346: Compiler generates incorrect assembly instructions

Part Number: TMS320C28346

Tool/software: TI C/C++ Compiler

Hello fellow engineers,

I upgraded my C2000 code generation tools from "v6.2.5" to "v16.12.0.STS" and ran to some problems compiling my code at optimization level -02 and -O3. The problem is present also in "v16.9.2.LTS". Compiling the code below give me following error:

"/tmp/07535RPc1RZ", ERROR! at line 151: [E0200] Block size 8 out of range
9..127
RPTB $C$L2,AR6 ; [CPU_] |14|

1 Assembly Error, No Assembly Warnings

Errors in Source - Assembler Aborted

>> Compilation failure

I have reduced the problematic code file "test.c" with creduce to bare bones and cleaned up the result a bit:

#include <string.h>

struct Foo_s {
    int a;
    char b;
};

struct Foo_s f_foos[10];

FuncA()
{
    int i = 0u;
    
    for (; i < 10; ++i)
    {
        struct Foo_s* foo = &f_foos[i];
        foo->a = 0;
        memset(foo, 0, 1);
    }
}

FuncB()
{
    int i = 0;
    struct Foo_s* foo = &f_foos[i];

    if (foo)
    {
        // Original creduce version was "strncpy(0, 0, 16);" which has
        // undefined behavior on some standards, so I modified the code to
        // satisfy "no overlapping strings" requirement.
        strncpy((char*)1, (char*)(1+16), 16);
    }
  
    return 0;
}

Makefile for compiling the above "test.c":

C2000_TOOLCHAIN_PATH=/home/ubuntu/toolchain/cgt
CC=$(C2000_TOOLCHAIN_PATH)/bin/cl2000
CFLAGS=--compile_only --silicon_version=28 --large_memory_model --float_support=fpu32 --unified_memory --opt_for_speed=5 -I$(C2000_TOOLCHAIN_PATH)/include -O2
SRC=./test.c

all:
$(CC) $(CFLAGS) $(SRC)

Is this a compiler problem? Or maybe its a problem with assembler? Any input is highly appreciated!

Best Regards,

Henrik