Bug 56708

Summary: g++ (gcc-c++-2.96-85.i386.rpm) generates incorrect code
Product: [Retired] Red Hat Linux Reporter: David Warme <david.warme>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.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: 2004-10-02 00:52:15 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
C++ source file for which g++ (gcc-c++-2.96-85.i386.rpm) gives bad code none

Description David Warme 2001-11-26 08:07:32 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux 2.2.16-22smp i686)

Description of problem:
Incorrect code is generated to evaluate the third argument (&g_array [n])
in the constructor call "new reae_ArcPnode (...)" (last assignment
statement
in the file.  The value g_array.d_array is added to an uninitialized stack
location instead of the proper array offset.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Get the source file "foo.cc".
2. g++ -S -O2 foo.cc
3. Examine generated "foo.s" file.  Search for "sprintf", which is called
right
   near the point where the bad code is generated.  On my system, the bad
   code can be found by searching backwards for the string "-104(%ebp)"
   which is the uninitialized stack location to which the array base is
added.
	

Actual Results:  The erroneous instruction is:

	addl	%eax, -104(%ebp)

Unfortunately, -104(%ebp) is uninitialized at this point.

Expected Results:  Should generate correct code.  For example, code
that placed the value 16*n into location -104(%ebp).

Additional info:

Comment 1 David Warme 2001-11-26 08:11:25 UTC
Created attachment 38524 [details]
C++ source file for which g++ (gcc-c++-2.96-85.i386.rpm) gives bad code

Comment 2 Jakub Jelinek 2001-11-28 10:08:50 UTC
Cannot reproduce this with gcc-c++-2.96-101 or (unless I screwed up)
gcc-c++-2.96-86. If the fixing release was really 2.96-86, then I'd guess
it is #40069 (don't want to spent time debugging whether it really is that
or not). Anyway, can you try a more recent gcc?

Comment 3 David Warme 2001-11-28 22:35:45 UTC
> Anyway, can you try a more recent gcc?

OK, so how do I get copies of gcc-{c|c++|f77|objc}-2.96-86.i386.rpm?
The newest stuff I see advertised for download for RH 7.0 is 2.96-85,
which is what I have?

Comment 4 Richard Henderson 2004-10-02 00:52:15 UTC
Fixed.