Bug 5398 - -O2&-O3 results in invalid code
Summary: -O2&-O3 results in invalid code
Status: RESOLVED DUPLICATE of bug 21920
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.0.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2002-01-15 18:16 UTC by ezharkov
Modified: 2005-06-05 09:37 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ezharkov 2002-01-15 18:16:01 UTC
/usr/local/bin/gcc -O2 hpgccbug.c ; ./a.out
produces invalid result

Release:
3.0.2

Environment:
System: HP-UX acoma B.11.00 A 9000/782 2008121131 two-user license

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;
}
Comment 1 ezharkov 2002-01-15 18:16:01 UTC
Fix:
Do not use -O2 -O3
Comment 2 Jakub Jelinek 2002-01-16 10:50:36 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Code doesn't obey strict aliasing rules
Comment 3 Andrew Pinski 2005-06-05 09:36:56 UTC
Reopening to ...
Comment 4 Andrew Pinski 2005-06-05 09:37:25 UTC
Mark as a dup of bug 21920.

*** This bug has been marked as a duplicate of 21920 ***