This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/28228] New: Optimize error on x86/x86_64


test.c
-----------------------------
int
main () {
  char ba[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  short a[4] = { 0x04, 0x05, 0x06, 0x07};

  int c = *((int *)(&a[1]));
  int d = *((int *)(&ba[1]));

  printf("%08x\n", c );
  printf("%08x\n", d );
  return 0;
}
--------------
gcc -O2
a.out

00000040
05040302
--------------
gcc -O
a.out

00060005
05040302


-- 
           Summary: Optimize error on x86/x86_64
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tyokota at k2 dot dion dot ne dot jp
 GCC build triplet: x86_64,x86_*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28228


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]