[Bug optimization/11066] New: error in the optimization of packed structures
jourgun@club-internet.fr
gcc-bugzilla@gcc.gnu.org
Mon Jun 2 17:44:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11066
Summary: error in the optimization of packed structures
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: major
Priority: P2
Component: optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jourgun@club-internet.fr
CC: gcc-bugs@gcc.gnu.org
error in the optimization of packed structures, when using -O2 or -O3.
preprossesor file:
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "c:/djgpp/lib/gcc-lib/djgpp/3.23/djgpp.ver" 1
# 1 "c:/djgpp/include/sys/version.h" 1 3
# 2 "c:/djgpp/lib/gcc-lib/djgpp/3.23/djgpp.ver" 2
# 2 "<command line>" 2
# 1 "test.c"
unsigned long long GateDescriptor(Offset,Segment,TypeDPL,ParamCount)
unsigned long Offset;
unsigned short Segment;
unsigned char TypeDPL,ParamCount;
{
typedef struct {
unsigned short Offset0_15;
unsigned short Segment;
unsigned char ParamCount;
unsigned char TypeDPL;
unsigned short Offset16_31;
}Tdescripteur __attribute__ ((packed));
Tdescripteur Descripteur;
Descripteur.Offset0_15=Offset;
Descripteur.Offset16_31=Offset>>16;
Descripteur.Segment=Segment;
Descripteur.TypeDPL=TypeDPL;
Descripteur.ParamCount=ParamCount;
return *(unsigned long long*)&Descripteur;
}
int main(void){
printf("%llX",GateDescriptor(0x65B,0x08,0xEF,0));
getchar();
}
Normaly, we would see :
EF000008065B
but we see:
EF000000065B
the complete command line is:
gcc test.c -o test.exe -O2
I am working on DJGPP on Windows XP.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Gcc-bugs
mailing list