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.
Tool/software: TI C/C++ Compiler
hi, I recently upgraded from 17.9 to 19.6 and got this error message:
>> ../source/motor/motor_current.cpp, line 37:
INTERNAL ERROR: >>>Register allocation failed:
Average(std::vector<float, std::allocator<float>>)
This may be a serious problem. Please contact customer support with a
description of this problem and a sample of the source files that caused this
INTERNAL ERROR message to appear.
Cannot continue compilation - ABORTING!
from this code:
float Average(std::vector<float> v)
{ float sum=0.0;
for(int i=0;i<v.size();i++)
sum+=v[i];
return sum/v.size();
}
all optimization is turned off.
I can repeat the failure, using the attached CCS project containing the same function:
**** Build of configuration Debug for project TMS320F28_cpp_internal_error **** /home/mr_halfword/ti/ccs910/ccs/utils/bin/gmake -k -j 12 all -O Building file: "../main.cpp" Invoking: C2000 Compiler "/home/mr_halfword/ti/ccs910/ccs/tools/compiler/ti-cgt-c2000_19.6.0.STS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --fp_mode=strict --include_path="/home/mr_halfword/workspace_v9/TMS320F28_cpp_internal_error" --include_path="/home/mr_halfword/ti/ccs910/ccs/tools/compiler/ti-cgt-c2000_19.6.0.STS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.cpp" >> Compilation failure subdir_rules.mk:7: recipe for target 'main.obj' failed "../main.cpp", line 9 (col. 15): advice #2614-D: (Performance) Use --fp_mode=relaxed to enable TMU hardware support for FP division. >> ../main.cpp, line 9: INTERNAL ERROR: >>>Register allocation failed: Average(std::vector<float, std::allocator<float>>) This may be a serious problem. Please contact customer support with a description of this problem and a sample of the source files that caused this INTERNAL ERROR message to appear. Cannot continue compilation - ABORTING! gmake: *** [main.obj] Error 1 gmake: Target 'all' not remade because of errors.
Thank you for reporting this problem. Thanks to the test case from Chester Gillon, I am able to reproduce the behavior. I filed the entry CODEGEN-6477 in the SDOWP system to have this investigated. You are welcome to follow it with the SDOWP link below in my signature.
Thanks and regards,
-George
A workaround is to make a local variable to hold the value of v.size(), and use that variable in place of the two calls to v.size().