Bug 5184

Summary: Optimizer bug in egcs-2.91.66
Product: [Retired] Red Hat Linux Reporter: Willi N|_er <wilhelm.nuesser>
Component: egcsAssignee: Cristian Gafton <gafton>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-02-05 18:57:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Slightly more elaborate strict_low_part patch none

Description Willi N|_er 1999-09-17 10:04:15 UTC
Hi,
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()
{
  f();
  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:
  http://egcs.cygnus.com/ml/gcc-patches/1999-09/msg01103.html
We will see what they say.

Comment 2 Jim Kingdon 1999-09-26 13:39:59 UTC
The update is at:
  http://egcs.cygnus.com/ml/gcc-patches/1999-09/msg01170.html

Comment 3 Jim Kingdon 1999-09-29 22:42:59 UTC
That patch may be a good choice.  See:
  http://egcs.cygnus.com/ml/gcc-patches/1999-09/msg01240.html

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.