Bug 289211 - gcc ignores __attribute((packed)); with -O2
gcc ignores __attribute((packed)); with -O2
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc4 (Show other bugs)
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2007-09-13 08:41 EDT by Laurent Wandrebeck
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-09-30 16:01:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Laurent Wandrebeck 2007-09-13 08:41:04 EDT
Description of problem:
gcc 4.1.1 on Centos 4.5 x86_64 compiles fine a C code using
__attribute((packed)) for a structure.
Running Centos 5 x86_64, gcc 4.1.1 seems to silently ignores the attribute, and
makes the resulting code computing wrong results.
This behaviour under Centos 5 disappears if -O1 is used instead of -O2.
CFLAGS used: -march=opteron -O2 -pipe.

Version-Release number of selected component (if applicable):
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)

How reproducible:
We use the code available here:
The problem is data are not publicly available.
I suppose any other code using __attribute((packed)) should show the same behaviour.

Steps to Reproduce:
Actual results:
zeroes are get from processing. (packed attribute ignored, but adresses
calculated for a packed structure, so getting zeroes?)

Expected results:
We're supposed to get real numbers.

Additional info:
Comment 1 Jakub Jelinek 2007-09-14 05:59:48 EDT
Please create a self-contained testcase that shows the kind of problem you are
talking about.  There are zero changes in between RHEL4.5 and RHEL5 gcc{4,}
that could affect this.
Comment 2 Jakub Jelinek 2007-09-30 16:01:56 EDT
Please reopen when you have the requested information.

Note You need to log in before you can comment on or make changes to this bug.