Bug 289211 - gcc ignores __attribute((packed)); with -O2
Summary: gcc ignores __attribute((packed)); with -O2
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc4
Version: 5.0
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-13 12:41 UTC by Laurent Wandrebeck
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-09-30 20:01:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Laurent Wandrebeck 2007-09-13 12:41:04 UTC
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:
http://www-icare.univ-lille1.fr/products/download/xrit_website/xrit-0.1.6.tar.gz
The problem is data are not publicly available.
I suppose any other code using __attribute((packed)) should show the same behaviour.

Steps to Reproduce:
1.
2.
3.
  
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 09:59:48 UTC
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 20:01:56 UTC
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.