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.
Hello,
Is there a way to get the C++ compiler to optimize out the reference variable, i..e just replace it with the variable being referenced?
Setting the optimization level to 4 and size vs speed tradeoff to 0 doesn't didn't cause the compiler to optimize out the reference. Please see simple program and map file output below.
Thanks,
Stephen
Example:
/** * main.c */ int efg = 0; int &abc = efg; int hij; int main(void) { hij = abc; return 0; }
1 0000d000 _abc 0 00009056 _abort 0 00009000 _c_int00 0 0000907f _copy_in 1 0000c00a _efg 0 00009058 _exit 1 0000c00b _hij 0 000090d1 _main 0 000090a3 _memcpy abs ffffffff binit 0 00008000 cinit 0 000090db etext abs ffffffff pinit
Build with the newer ABI setting --abi=eabi. Then the compiler automatically gets rid of abc.
This may not be a practical solution. You can use EABI only if all the other software you use (C2000Ware, etc.) is also built for EABI.
Thanks and regards,
-George
I am using sys/bios (6.46.6.0), compiler version 21.12.0.STS and xdctools_3_31_03_43.
I received the following error when I tried to compile my project with --abi=eabi. Is this error caused by setting --abi=eabi or an issue with a compiler/syssbios/xdc version issue?
js: "./config.bld", line 10: Error: Can't find the target named 'ti.targets.elf.C28_float' along the path 'C:/ti/bios_6_46_06_00/packages;C:/ti/ccs930/ccs/ccs_base;C:/ti/xdctools_3_31_03_43_core/packages;..;': please check the spelling of the target's name and that it exists along this path.
xdctools_3_31_03_43_core\gmake.exe: *** No rule to make target `.configuro'. Stop.
js: "C:/ti/xdctools_3_31_03_43_core/packages/xdc/tools/Cmdr.xs", line 51: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted.
gmake[2]: *** [build-21490655-inproc] Error 1
makefile:345: recipe for target 'all' failed
gmake[1]: *** No rule to make target 'build-21490655', needed by 'configPkg/compiler.opt'. Stop.
gmake: *** [all] Error 2