Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 5184 - Optimizer bug in egcs-2.91.66
Summary: Optimizer bug in egcs-2.91.66
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 6.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-09-17 10:04 UTC by Willi N|_er
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2000-02-05 18:57:47 UTC

Attachments (Terms of Use)
Slightly more elaborate strict_low_part patch (deleted)
1999-12-08 21:38 UTC, Jim Kingdon
no flags Details

Description Willi N|_er 1999-09-17 10:04:15 UTC
when compiling the appended C-code first with
gcc -v -save-temps bug.c
and then with
gcc -v -save-temps -O bug.c
you will see garbage at the end of the output of the
optimized case.

Best regards
Willi N|_er, LinuxLab SAP AG

****** bug.c ********************************

#include <stdio.h>
#include <stdlib.h>

/*#define TRAILER 0x07*/
#define TRAILER 'A'

static char buf[40];
static char line[30] = "1234567890123456789012345678*";

static void f()
  char trailer[2] = { TRAILER, 0x00 };
  char* const last = buf + sizeof(line) - 2;
  memcpy(buf, line, sizeof(line));
  if (*last == '*')
    memcpy(last, trailer, 2);

int main()
  printf("%s\n", buf);
  return 0;

****** end of bug.c ******************************

Comment 1 Jim Kingdon 1999-09-23 15:35:59 UTC
I have sent a fix for this to the GCC gurus at:
We will see what they say.

Comment 2 Jim Kingdon 1999-09-26 13:39:59 UTC
The update is at:

Comment 3 Jim Kingdon 1999-09-29 22:42:59 UTC
That patch may be a good choice.  See:

Comment 4 Jim Kingdon 1999-12-08 21:38:59 UTC
Created attachment 37 [details]
Slightly more elaborate strict_low_part patch

Comment 5 Bill Nottingham 2000-02-05 18:57: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.