AnsweredAssumed Answered

KDS v3.2.0 #pragma GCC pop_options broken

Question asked by Carl Norman on Mar 28, 2017
Latest reply on Mar 31, 2017 by Paddock

I have posted this question below in a related thread but have no answer, and I dont seem to be able to put a support ticket in anymore...

The compiler option of O0, O1, O2, Os in Debug mode 

 

I have some issues with my project using a struct that wont work correctly in release. Below I have fixed it by turning optmisation down to 0 for the struct but I am not 100% sure its pushing an popping the optmizations as the "correct way" is broken (still)... Anyone confirm if this is right, or, how I should do it knowing #pragma GCC pop_options is broken? I cannot get __attribute__((optimize("O0"))) to work, if someone can tell me how to add this attribute to a struct below that might help. 

 

<HEADER FILE>

typedef struct
__attribute__((__packed__))
{

   int value1;

   unsigned long value2;

   char string1;

}ramtable_s;

extern volatile ramtable_s RamTable;

 

 

<C FILE>

#pragma pack(push)
#pragma GCC optimize("O0")

volatile ramtable_s RamTable =
{

   .value1 = 0;

   .value2 = 10;

   .string1 = "TEST";

};

#pragma pack(pop)

 

PS the #pragma GCC optimize("O0") is 100% working in this case, but, im worried its staying at level 0 for the rest of the code and I am not sure how to prove / disprove this.

 

the other way to resolve this is to have some sort of SECTION defined and KEEP  it in the linker. 

Outcomes