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]

c/5398: -O2&-O3 results in invalid code



>Number:         5398
>Category:       c
>Synopsis:       -O2&-O3 results in invalid code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 15 18:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     ezharkov@yahoo.com
>Release:        3.0.2
>Organization:
>Environment:
System: HP-UX acoma B.11.00 A 9000/782 2008121131 two-user license
>Description:
/usr/local/bin/gcc -O2 hpgccbug.c ; ./a.out
produces invalid result
>How-To-Repeat:
#include <stdio.h>
int main (void) {
  int i = 0x12345678;
  short*s = (short*) &i;
  printf ("%x %x\n", s[0], s[1]);
  return 0;
}
>Fix:
Do not use -O2 -O3
>Release-Note:
>Audit-Trail:
>Unformatted:


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