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.

Exception occurs after optimization

Other Parts Discussed in Thread: OMAPL138, SYSBIOS

My target is an OMAPL138

Tools:

CCS version = 5.1.0

TI compiler = 7.3.5

SYSBIOS = 6.33.4.39

XDCtools = 3.23.2.47

I'm seeing a very strange behavior when I optimize a file (math.c) with what I believe to be a simple function; vectorSum32().  When I optimize math.c with -o2 or -o3 my program experiences an exception during runtime.   Less or no optimization results in correct behavior.  Any ideas on what I may be doing wrong?

math.c code snippet:

int40_t vectorSum32(int32_t* restrict data,

  int40_t startingValue,

  int32_t length)

{ 

int i;

int40_t accum = startingValue;

for (i = 0; i < length; i++)

{

accum = _lsadd(*data++, accum);

}

return accum;

}

The build output is provided below:

C:\ti\ccsv5\utils\bin\gmake -k -j2 all 

'Building file: ../CommonC6x/math.c'

'Invoking: C6000 Compiler'

"C:/ti/ccsv5/tools/compiler/c6000_7.3.5/bin/cl6x" -O2 --define=C674x --include_path="C:/ti/ccsv5/tools/compiler/c6000_7.3.5/include" --include_path="C:/Program Files/Texas Instruments/biospsp_03_00_01_00" --display_error_number --diag_warning=225 --abi=coffabi -k --asm_listing --preproc_with_compile --preproc_dependency="CommonC6x/math.pp" --obj_directory="CommonC6x" --cmd_file="./configPkg/compiler.opt"  "../CommonC6x/math.c"

'Finished building: ../CommonC6x/math.c'

When the exception occurs the CCS console output is provided below:

[C674X_0] A0=0x1 A1=0x0

[C674X_0] A2=0x0 A3=0x11827884

[C674X_0] A4=0x0 A5=0x10b20800

[C674X_0] A6=0x0 A7=0x16e36000

[C674X_0] A8=0x0 A9=0x1181ba18

[C674X_0] A10=0x14000103 A11=0x118277cc

[C674X_0] A12=0x0 A13=0x0

[C674X_0] A14=0x0 A15=0x0

[C674X_0] A16=0x302e3030 A17=0x0

[C674X_0] A18=0x11824fa0 A19=0x40

[C674X_0] A20=0x1181aaa0 A21=0x0

[C674X_0] A22=0xc1f17bc9 A23=0x0

[C674X_0] A24=0xa34b5d17 A25=0xfa367fe5

[C674X_0] A26=0x1c14164 A27=0x1c14164

[C674X_0] A28=0x1c14160 A29=0x1c14160

[C674X_0] A30=0x20 A31=0x0

[C674X_0] B0=0x1 B1=0x0

[C674X_0] B2=0x0 B3=0xc

[C674X_0] B4=0x11827ae4 B5=0xbe

[C674X_0] B6=0x79 B7=0x697f2f5

[C674X_0] B8=0x0 B9=0x11827990

[C674X_0] B10=0x1 B11=0x118277c8

[C674X_0] B12=0x0 B13=0x0

[C674X_0] B14=0x11829ee8 B15=0x1181fc48

[C674X_0] B16=0xbebebebe B17=0xbebebebe

[C674X_0] B18=0xa B19=0x78

[C674X_0] B20=0x69 B21=0x3588fad4

[C674X_0] B22=0xf B23=0x0

[C674X_0] B24=0xd0893a65 B25=0xe7d21ef9

[C674X_0] B26=0x4a118285 B27=0xf784eb9f

[C674X_0] B28=0xbd98d524 B29=0x11f03dc0

[C674X_0] B30=0x11f03dc0 B31=0x0

[C674X_0] NTSR=0x1020f

[C674X_0] ITSR=0x20f

[C674X_0] IRP=0x118133c4

[C674X_0] SSR=0x0

[C674X_0] AMR=0x0

[C674X_0] RILC=0x0

[C674X_0] ILC=0x0

[C674X_0] Exception at 0xc

[C674X_0] EFR=0x2 NRP=0xc

[C674X_0] Internal exception: IERR=0x1

[C674X_0] Instruction fetch exception

[C674X_0] ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x118133c4, sp = 0x1181fc48.

[C674X_0] To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'

[C674X_0] xdc.runtime.Error.raise: terminating execution

Thanks in advance,

Dave M