I’m facing a problem with MinGW and nested structure
Description
We develop software for embedded controlled which can be compiled on HW target or PC target. Compilers used are different for each target, this problem only happens on PC target (MinGW compiler), not on HW.
The structure is the following, it contains multiple structures (like tMember1 and tMember2) and different structures which share the same name.
typedef struct
{
TBoolean boDummmyMember; //!< [-] - dummy variable
} TMemberElement;
typedef struct
{
TBoolean boAvailable; //!< [-] - enable the function
TMemberElement tEle;
} TMemberStruct;
typedef struct
{
TBoolean boDummmyMainStruct; //!< [-] - dummy variable
} TMainStructElement;
typedef struct
{
TMemberStruct tMember1;
TMemberStruct tMember2;
TMainStructElement tEle;
} TMainStruct;
There is two problem, the first one at init. The compiler initialize tEle of tMember1 and tMember2 with TMainStructElement instead of TMemberElement
The second one is when modifying one variable of one TMemberStruct, it updates the other variable too
The compiler flags are the following (with -O0 meaning no optimizations): CC_FLAGS += -Wall -O0 -fshort-enums
I have to say we found workarounds which works but make the code less readable (removing the main structure when it can be done as an example)
Do you know why it can’t be used ? Thanks in advance
2