This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
optimization/108: code generation bug in current CVS
- To: gcc-gnats at gcc dot gnu dot org
- Subject: optimization/108: code generation bug in current CVS
- From: Martin Reinecke <martin at MPA-Garching dot MPG dot DE>
- Date: Tue, 14 Mar 2000 15:22:19 +0100
- Reply-To: martin at MPA-Garching dot MPG dot DE
- Resent-Cc: gcc-prs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, martin@MPA-Garching.MPG.DE
>Number: 108
>Category: optimization
>Synopsis: gcc version 2.96 20000314 generates wrong code when optimizing
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 14 06:26:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Martin Reinecke
>Release: 2.96
>Organization:
Max-Planck-Institut fuer Astrophysik
>Environment:
System: Linux lnxncb-2 2.2.10 #4 Tue Oct 26 12:39:30 CEST 1999 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
>Description:
In the attached testcase, the same operation is done on two VECTORS,
which differ only in constntess. But the current CVS version of g++
produces a bogus result for the const VECTOR.
A detailed analysis of probably the same bug is given in
http://gcc.gnu.org/ml/gcc-bugs/2000-02/msg00678.html
>How-To-Repeat:
// compile with g++ -O2
class VECTOR
{
public:
double x, y, z;
VECTOR (double xc, double yc, double zc)
: x(xc), y(yc), z(zc) {}
};
int main ()
{
const VECTOR vec (0.,0.,1.);
VECTOR vec2 (0.,0.,1.);
double foo = vec.x* vec.x + vec.z* vec.z;
double foo2 = vec2.x*vec2.x + vec2.z*vec2.z;
// if something is wrong, exit with code 1
if (foo != foo2) exit(1);
exit (0);
}
>Fix:
compile with -O0 or -O1
>Release-Note:
>Audit-Trail:
>Unformatted: