Opened 10 years ago

Closed 10 years ago

#289 closed defect (invalid)

Building with -fpack-struct=1 breaks struct stat

Reported by: Yuri Dario Owned by:
Priority: normal Milestone: libc-0.6.6
Component: libc Version: 0.6.5
Severity: trivial Keywords:
Cc:

Description

While struct stat has a size of 108 bytes when built without special flags, with

gcc -fpack-struct=1 stat.c

size of struct stat changes to 106 bytes. Adding

#pragma pack(4) ... #pragma pack()

around structure declarations in sys/stat.h fixes the issue.

I wonder if other structures has the same problem.

Change History (2)

comment:1 Changed 10 years ago by Yuri Dario

I see my linux mint 16 installation shows same issue, from 88 down to 84.

And I see this in gcc manual:

Warning: the -fpack-struct switch causes GCC to generate code that is not binary compatible with code generated without that switch. Additionally, it makes the code suboptimal. Use it to conform to a non-default application binary interface.

Maybe I need to avoid using -fpack-struct=1...

comment:2 Changed 10 years ago by bird

Resolution: invalid
Status: newclosed

Specifying non-default structure packing when including kLibC headers is your problem, not mine.

Note: See TracTickets for help on using tickets.