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.

CGT7.2.3/4 compiler bug for DM6467T

Hi,

Maybe we got a rare bug of CGT compiler, detailed as below:

Compiler:  CGT7.2.3 and CGT7.2.4

Platform:  DM6467T

Description:

1) Please see the attachment for the function my_testfunc();

2) It works ok with compiler options -O0 and -O1

3) Failes with -O2 or -O3

4) For most of  s_data1/s_data2 ,  the function works ok with -O2 and -O3

5) But for some rare piece of s_data1/s_data2 , it failes.  The s_data1/s_data2  in the attachment is a sample which casue the function fail.

Any one can give some hint to resolve the problem?

Thanks!

 

#include <stdlib.h>

// SAD
// OK: sum = 4300		// -O0, -O1
// FAIL sum = 4044		// -02, -O3

static unsigned char s_data1[] = 
{
	53,53,53,53,53,53,53,53,
	84,84,84,84,84,84,84,84,
	101,101,101,101,101,101,101,101,
	49,49,49,49,49,49,49,49,
	44,44,44,44,44,44,44,44,
	46,46,46,46,46,46,46,46,
	43,43,43,43,43,43,43,43,
	101,101,101,101,101,101,101,101
};

static unsigned char s_data2[] = 
{
	73,82,114,155,154,154,151,157,
	118,123,144,157,160,168,156,162,
	73,104,155,159,154,158,156,159,
	52,58,138,161,158,168,162,167,
	48,56,108,164,155,160,157,166,
	46,54,88,165,159,164,159,157,
	44,48,81,161,172,169,169,164,
	88,97,84,94,129,125,142,147
};

int my_testfunc(void) 
{                                                   
    int sum = 0, x, y;
	
	unsigned char *data1 = s_data1;
	unsigned char *data2 = s_data2;
	
    for (y = 0; y < 8; y++)                   
    {                                               
        for (x = 0; x < 8; x++)
        {         
           sum += abs(data1[x] - data2[x]);
        }

        data1 += 8;
        data2 += 8;
    }                                         
	
    return sum;                                   
}



################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Each subdirectory must supply rules for building sources it contributes
mytest.obj: ../mytest.c $(GEN_OPTS) $(GEN_SRCS) $(CFG_SRCS)
	@echo 'Building file: $<'
	@echo 'Invoking: Compiler'
	"C:/ccs4/ccsv4/tools/compiler/c6000/bin/cl6x" -mv64+ --symdebug:none -O2 --relaxed_ansi --gcc --define="xdc_target__=<ti/targets/std.h>" --include_path="C:/ccs4/ccsv4/tools/compiler/c6000/include" --include_path="C:/ccs4/xdais_6_25_02_11/packages" --include_path="C:/ccs4/xdctools_3_16_01_27/packages" --diag_warning=225 --abi=coffabi --opt_for_speed=5 --preproc_with_compile --preproc_dependency="mytest.pp" $(GEN_OPTS_QUOTED) $(subst #,$(wildcard $(subst $(SPACE),\$(SPACE),$<)),"#")
	@echo 'Finished building: $<'
	@echo ' '

 

  • I have submitted a bug report for this issue, the tracking # is SDSCM00041042. It has been assigned to the compiler team for further analysis and to be addressed in a future release. You can track the status of the bug using the SDOWP link in my signature. For now, please use a lower optimization level as a workaround.