Environment:
- DSP: TMS320C64xx
- Tool set #1:
- CCS: 5.0.3 (Ubuntu Linux AND Windows XP gives same result)
Help shows version N201105110900
- Code Generation Tools: 7.2.1 (bundled with CCS)
- Tool set #2:
- CCS: 4.2.4.00033 (Windows XP)
- Code Generation Tools: 7.2.1 (bundled with CCS)
I see the same problem in both tool sets.
I have a function that fails when optimized with -O3 or -O2.
(-O1 works fine). Also compiling with older tools (the tools bundled
with CSS 3.3 -O3 works fine for this code).
I have created a new projeckt based on the "Basic/Hello world" example for C64xx and changed settings to optimization level = 3.
hello.c should be replaced by the attached hello.c.txt.
The error can be removed by one of those things - but I don't like to do that:
- Replace the last multiplication by:
tmpb = (int)a[i][1]
- Replace the 2-dimensional array by two one-dimensional arrays
Console output:
(Same result have been found for Windows XP installation)
from Linux Ubuntu 11.04 with updates:
**** Build of configuration Debug for project css_err_mult2 ****
/usr/local/CCSv5/ccsv5/utils/gmake/gmake -k all
Building file: ../hello.c
Invoking: C6000 Compiler
"/usr/local/CCSv5/ccsv5/tools/compiler/c6000/bin/cl6x" -mv6400 -g -O3 --include_path="/usr/local/CCSv5/ccsv5/tools/compiler/c6000/include" --diag_warning=225 --abi=coffabi --preproc_with_compile --preproc_dependency="hello.pp" "../hello.c"
>>>> Optimizer terminated abnormally
>>>> in function _sqr2()
>>>> in file "../hello.c"
>> Compilation failure
gmake: *** [hello.obj] Error 1
gmake: Target `all' not remade because of errors.
#include <stdio.h> #define DATA_LGD 3 // Normally longer static int sqr2(const short (*a)[2], int n) { int max = 0; int i; for(i = 0; i<n; i++) { int tmpa; int tmpb; tmpa = (int)a[i][0] * a[i][0]; tmpb = (int)a[i][1] * a[i][1]; tmpa += tmpb; if (tmpa > max) { max = tmpa; } } return max; } void main(void) { printf("Hello World example expanded to show CCS5 optimize error.\n"); int num = DATA_LGD; // Normally higher value const short data[DATA_LGD][2] = {{0, 1},{0, 1},{0, 1}}; int res = sqr2(data, num); printf("Dummy result: %i", res); }