This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/33379] New: Bad code generation with O3
- From: "tompa-l at prolan dot hu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Sep 2007 14:40:56 -0000
- Subject: [Bug c/33379] New: Bad code generation with O3
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello ,
this code below compiles with different results.
with -O0 the result is 1.(expected res.)
from -O2 (and above) the result is 0.(BUG!)
Thank You !
include<stdio.h>
#ifdef _BIG_ENDIAN
#define FP_SEG(fp) (*((unsigned short*)&(fp)))
#define FP_OFF(fp) (*((unsigned short*)&(fp)+1))
#else
#define FP_SEG(fp) (*((unsigned short*)&(fp)+1))
#define FP_OFF(fp) (*((unsigned short*)&(fp)))
#endif
#define BYTE unsigned char
#define _huge
unsigned short int zHugeOffset;
int main(){
BYTE _huge *phb;
unsigned short int selBit;
FP_SEG(phb)=0; FP_OFF(phb)=0xffff; phb+=0x8000; selBit=FP_SEG(phb);
zHugeOffset=selBit;
printf("RESULT :%hd\n", zHugeOffset);
}
--
Summary: Bad code generation with O3
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tompa-l at prolan dot hu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33379