Bug 6855 - An egcc optimizer bug
Summary: An egcc optimizer bug
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs (Show other bugs)
(Show other bugs)
Version: 6.0
Hardware: i386 Linux
high
high
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-11-09 18:16 UTC by ezharkov
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

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


Attachments (Terms of Use)

Description ezharkov 1999-11-09 18:16:21 UTC
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 21:52:59 UTC
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 18:59:59 UTC
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.