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.

Why not zero initialization for global variables in COFF ABI Mode?

Hi,

I faced Initializing Static and Global Variables in COFF ABI Mode with below code on C6000 device.

t_struct *gp_list[5] = { NULL };

I needed to set below code.

t_struct *gp_list[20] = { NULL, NULL, NULL, NULL, NULL};

There is no clear descriptions in 6.13 compiler document for above case.
How sould I know above restriction?

I believe that someone will face the same issue in the future.

Do you plan to revise 6.13 clearly for above case or compiler modification for warning message?  

I found below thread but no discussion for document and tool improvement.

https://e2e.ti.com/support/development_tools/compiler/f/343/t/353583

http://e2e.ti.com/support/development_tools/compiler/f/343/t/495704

          

6.13 Initializing Static and Global Variables in COFF ABI Mode
The ANSI/ISO C standard specifies that global (extern) and static variables without explicit initializations
must be initialized to 0 before the program begins running. This task is typically done when the program is
loaded. Because the loading process is heavily dependent on the specific environment of the target
application system, in COFF ABI mode the compiler itself makes no provision for initializing to 0 otherwise
uninitialized static storage class variables at run time. It is up to your application to fulfill this requirement.
Initialize Global Objects
NOTE: You should explicitly initialize all global objects which you expected the compiler would set to
zero by default.
In C6000 EABI mode the uninitialized variables are zero initialized automatically.

Regards,

Kasuya