Part Number:TMS320F280049C
Hi teams,
complier version: 18.12.4
I complie my source code without enable complier optimization, it works well and without any complie error.
But once if the optimization enable with O2, the consoles shows
>> Compilation failure
driver/e2prom/m24256/subdir_rules.mk:9: recipe for target 'driver/e2prom/m24256/m24256.obj' failed
>>>> Optimizer terminated abnormally
>>>> in function _m24256_get_state()
>>>> in file "../driver/e2prom/m24256/m24256.c"
This is caused by a defect in the TI C/C++ Optimizer.
In the function
enum e2prom_state m24256_get_state(struct e2prom_drv *drv)
{
return (container_of(drv, e2prom_type, drv))->state;
}
about the macro "container_of "
#define offset_of(type, field) ((unsigned long)&(((type*) 0)-> field))
#define container_of(ptr, type, member) (type *)((long)ptr – offset_of(type, member))
by the way, the "container_of" macro also be used in other source files, but it still works and without any compile error
I cannot understand why the error only occurred in this function.
Please help me to solve this issue, thanks.
Green Deng:
你好,还请留意以下帖子的工程师回复:e2e.ti.com/…/tms320f280049c-complie-optimizate-defect