Incorrect struct align, data corruption

Bug #1464818 reported by Den
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

Please see screenshots in attachments.

Revision history for this message
Den (adskdn7) wrote :
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

Hi Den,

I tried to reproduce your issue but to no avail. In my test the structure is correctly padded to have a size of 12 bytes. Can you give us a complete testcase? If not, can you at least show us how is motorData declared?

Best regards.

Revision history for this message
Den (adskdn7) wrote :

Hi Thomas,

Struct declaration can be seen on gcc_bug3.jpg
I've also have discovered that #pragma pack(4) or #pragma pack(1) on structure declaration resolves the issue.

I'll try to strip out the code later if you would be unable to reproduce the issue, have no time now..
I think issue is related only to parameter (struct pointer) returned from function called by pointer.

Revision history for this message
Den (adskdn7) wrote :

Sorry, didn't understand. It's declared as static global var in ServoController.c

static MotorGetData motorData[MOTOR_COUNT];

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.