Bug 6855 - An egcc optimizer bug
An egcc optimizer bug
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: egcs (Show other bugs)
6.0
i386 Linux
high Severity high
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-11-09 13:16 EST by ezharkov
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-02-05 13:59:46 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description ezharkov 1999-11-09 13:16:21 EST
The following program:

tcsh> cat bug.c
#include <stdio.h>
#include <stdlib.h>

union u {
  unsigned i;
  struct {
    unsigned low : 16;
    unsigned high : 16;
  } s;
};

static void cvt (unsigned *v) {
  union u u;
  u.i = *v;
  u.s.low = 3;
  memcpy (v, &u.i, sizeof (unsigned));
}

int main () {
  unsigned i = 0x00010002;
  cvt (&i);
  printf ("res = %08x\n", i);
  return EXIT_SUCCESS;
}

Compiled on:

tcsh> uname -a
Linux hostname 2.2.12 #3 SMP Thu Sep 2 03:34:03 MDT 1999
i586 unknown

Using cc:

tcsh> cc --version
egcs-2.91.66

With the command:

tcsh> cc -O1 -o bug bug.c

Produces the following result:

tcsh> ./bug
res = 00000003

I would prefer it to produce a "00010003" result.
Comment 1 Jim Kingdon 1999-11-09 16:52:59 EST
At first glance this looks like the same bug as 5184 (also see
http://people.redhat.com/kingdon/), which for reference concerns
the "addressof" feature within GCC.
Comment 2 Bill Nottingham 2000-02-05 13:59:59 EST
Fixed in the egcs currently in Raw Hide.

Note You need to log in before you can comment on or make changes to this bug.