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.

Compiler/TMS570LS1227: using –o2 and –o3 compiler does not generate constructor calls (struct is not initialized correctly)

Part Number: TMS570LS1227

Tool/software: TI C/C++ Compiler

Hi,

I am using CGT v5.2.9.

Can somebody please advise the scope of the issue described in associated SDSCM00040934.

Is it restricted to C++ and constructor call generation, or do I need to consider my use of linker defined symbols in C structure initialisation (both constants in flash and RAM based initialisation)?

Regards, Tony

  • Tony Morrell said:
    Is it restricted to C++

    I cannot find a way to make the bug happen in C.

    This forum thread is the original report on the issue.  The test case in that thread is in C++.  The critical line is ...

    Info Info2((unsigned)_end_isr_stack - (unsigned)_start_isr_stack);

    A similar thing in C could be written ...

    struct Info Info2 = { (unsigned)_end_isr_stack - (unsigned)_start_isr_stack };

    But that is not legal C.  In C, such initializations are limited to compile time constant expressions.

    Thanks and regards,

    -George