This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

optimization/108: code generation bug in current CVS



>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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]