This is the mail archive of the gcc-bugs@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]

Internal compiler error on compiling Mindseye


Dear sir,

I hit the error as below:

c++ -c -g -O2 -I/opt/MindsEye/src/include/plib -I../ -DHAVE_CONFIG_H
-fno-implicit-templates s_nurbscurve.cpp
s_nurbscurve.cpp: In method `class G3DNurbsCurve &
G3DNurbsCurve::operator =(const PlNurbsCurvef &)':
s_nurbscurve.cpp:352: Internal compiler error.
s_nurbscurve.cpp:352: Please submit a full bug report.
s_nurbscurve.cpp:352: See
<URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make[1]: *** [s_nurbscurve.o] Error 1

The offending segment is:

 G3DNurbsCurve&
G3DNurbsCurve::operator=(const PlNurbsCurvef &a)
{
  this->NurbsCurve::operator=( a );
  return *this;
}

Please find attached the offending source and its header file.  

The entire source tree can be found at:  

ftp://ftp.cs.umn.edu/users/mein/mindseye/mindseye_0.5/mindseys_0.5.36.tgz

Sorry it was too big to email.

I am using the Debian woody distribution with 2.95.2-14 gcc.

Please advise if there is a way to work around it.

Regards,

P.C. Chan
/*
 * Project : "MindsEye, 3D library"
 * Copyright (c) 1995 - 1997. All Rights Reserved.
 * Author(s): P. Lavoie, M. Kuball
 *
 * $Id: s_line.cpp,v 1.18 1998/10/11 16:07:15 source Exp $
 *
 *
 * COPYRIGHT
 * =========
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * OVERVIEW
 * ========
 *
 */

#include <GL/gl.h>
#include <GL/glu.h>
#include "s_nurbscurve.h"
#include "s_point.h"
#include "pointstuff.h"
#include "camera.h"


GLUnurbsObj *G3DNurbsCurve::NurbsRenderer_   = NULL;
float        G3DNurbsCurve::tesselTolerance_ = 0.1;


G3DNurbsCpolygon::~G3DNurbsCpolygon()
{
}


void
G3DNurbsCpolygon::shade( void ) const
{
  glBegin(GL_LINE_STRIP);
  //glColor() ;
  for( int i = 0; i < curve.ctrlPnts().n(); ++i )
    glVertex4fv( curve.ctrlPnts()[i].data );  //TODO glVertex3 sufficient here?
  glEnd() ;
}


//--------------------------------------------------------------

IMPLEMENT_DYN(G3DNurbsCurve, "NURBS_curve")

void
G3DNurbsCurve::applyTransform()
{
  if( trafo_ )
    {
      /*
      MatrixRT<> T( (const MeFloat*)trafo_ );
  rx *= M_PI/180.0 ;
  ry *= M_PI/180.0 ;
  rz *= M_PI/180.0 ;

  MatrixRT<float> T(rx,ry,rz,tx,ty,tz) ;
  MatrixRT<float> Sx ; 
  Sx.scale(sx,sy,sz) ;

  transform(T*Sx) ;
  
  tx = ty = tz = rx = ry = rz = 0 ;
  sx = sy = sz = 1 ;
  resetBoundingBox() ;
  */
    }
}


void
G3DNurbsCurve::doAction( ActionData &action )
{
  switch( action.type )
    {
    case A_SELECT:
      resetKnots(); break;
    }

  G3DNurbs::doAction( action );
}

Field G3DNurbsCurve::FieldList_[4] =
{ {"degree", s_number}, {"knot_vec", m_flt}, {"knot_num", s_number},
  {"cpt_vec", m_vctrlPt}
};

const Field*
G3DNurbsCurve::getFieldList( void ) const
{
  return( FieldList_ );
}

uint
G3DNurbsCurve::getParameter( Param *list )
{
  if( list )
    {
      list->number  = deg_ ;
      list++;
      list->fltList = U.memory();
      list++;
      list->number  = U.size();
      list++;
      list->vCtrlPt = &P;
    }
  return( 4 );
}

G3DObject*
G3DNurbsCurve::getSelectionHandle_( void )
{
  return( new G3DCPoint(P[selectionIndex_], this) );
}

int
G3DNurbsCurve::initClass( void )
{
  tesselTolerance_ = 0.1;
  NurbsRenderer_ = gluNewNurbsRenderer();
  if( NurbsRenderer_ )
    {
      gluNurbsProperty( NurbsRenderer_, (GLenum)GLU_SAMPLING_TOLERANCE, 40.0 );
      return( 1 );
    }
  else
    return( 0 );
}

void
G3DNurbsCurve::modifyPoint( MeFloat u, MeFloat, MeFloat dx, MeFloat dy,
			    MeFloat dz )
{
  Point3Df delta( dx, dy, dz );
  if( u < knot()[0] )
    u = knot()[0];
  if( u > knot()[knot().n()-1] )
    u = knot()[knot().n()-1];
  movePoint( u, delta );
}

void
G3DNurbsCurve::point( MeFloat &u, MeFloat&, int pSize, const G3DColor& colorP,
		      int ) const
{
  if( u < U[0] )
    u = U[0] ;
  if( u > U[U.n()-1] )
    u = U[U.n()-1] ;

  glPointSize(pSize) ;
  float color[4];
  color[0] = color[1] = color[2] =  0.0 ;
  color[3] = 1.0 ;
  glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, color );
  //TODO
  //glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, (const float*)colorP );

  glBegin(GL_POINTS);
  glVertex4fv( pointAt(u).data );
  glEnd() ;
}

void
G3DNurbsCurve::resetBoundingBox( void )
{
  G3DPoint3d min, max;

  min[0] = extremum( 1, coordX );
  min[1] = extremum( 1, coordY );
  min[2] = extremum( 1, coordZ );
  max[0] = extremum( 0, coordX );
  max[1] = extremum( 0, coordY );
  max[2] = extremum( 0, coordZ );

  bbox_.setTo( min, max );
  if( parent_ )
    ((G3DShape*)parent_)->resetBoundingBox();
}

/*
void G3DNurbsCurve::resetCPoints()
{
  G3DCPoint *tempCP ;

  //TODO set a color attribute to the cpoints group
  cpoints.reset();
  
  if( P.n > 10 )
    cpoints.setJumpSize(int(P.n/10.0)) ;
  else
    cpoints.setJumpSize(int(float(P.n)/2.001 + 1)) ;
    

  for( int i = 0; i < P.n; ++i )
    {
      tempCP = new G3DCPoint( P[i] );
      //tempCP->setObjectColor( cpointColorDefault );
      //tempCP->setCurrentColor(cpointActiveColorDefault) ;
      //if( i == 0 )
      //tempCP->setObjectColor(cpoint0ColorDefault) ;
      cpoints.addShape( tempCP );
    }
}
*/

void G3DNurbsCurve::resetKnots()
{
  G3DKnot *tempCP ;

  //TODO set a color attribute to the knots group
  knots_.reInitialize();
  /*
  if(P.n()>10)
    knots.setJumpSize(int(P.n/10.0)) ;
  else
    knots.setJumpSize(2) ;
    */

  for( int i = 0; i < U.n(); ++i )
    {
      //calcualte the point on the curve corresponding to knot i
      Point3Df p = pointAt( U[i] );
      // we must represent multiple knots by only 1 point
      // but with a bigger radius (increase radius by 1)
      tempCP = new G3DKnot( p, i, -1 );
      //tempCP->setObjectColor( knots.objectColor );
      //tempCP->setCurrentColor( knots.currentColor );
      //if( i == 0 )
      //tempCP->setObjectColor( cpoint0ColorDefault );
      int psize = 4;
      int j = i;
      while( j < (U.n() - 1) )
	{
	  if( U[j+1] <= U[j] )
	    {
	      ++psize ; ++j ;
	    }
	  else
	    j = U.n() ;
	}
      tempCP->setPsize( psize );
      knots_.push_back( tempCP );
    }
}

MeFloat
G3DNurbsCurve::selectDetails( const G3DCamera &cam, const G3DRay &ray )
{
  MeFloat   rad = 6;
  G3DMatrix mw;
  getWorldTrafo( mw );

  selectionIndex_ = findNearestCPointV( cam, ray, mw, P, rad );
  if( selectionIndex_ >= 0 )
    return( rad );
  else
    return( G3D_INFINITY );
}

void
G3DNurbsCurve::setParameter( const Param *plist )
{
  if( plist )
    {
      deg_ = plist->number;            ++plist;
      MeFloat *knots = plist->fltList;  ++plist;
      Vector_FLOAT u( knots, plist->number );
      ++plist;
      U  = u;
      delete[] knots;

      P   = *plist->vCtrlPt;
      delete plist->vCtrlPt;

      resetBoundingBox();
    }
}

void
G3DNurbsCurve::shade( int ) const
{
  if( NurbsRenderer_ )
    {
      glLineWidth( 2.0 ); 
      GLenum t = GL_MAP1_VERTEX_4;
      gluBeginCurve( NurbsRenderer_ );
      gluNurbsCurve( NurbsRenderer_, U.n(), U.memory(), 4, P.memory()->data,
		     deg_+1, t );
      gluEndCurve( NurbsRenderer_ );

    /*
      // This code tests the tesselation code for a Nurbs Curve
    BasicList<Point3Df> list ;
    list = tesselate(0.01) ;
    BasicNode<Point3Df>* node = (BasicNode<Point3Df>*)list.first ;
    glBegin(GL_LINE_STRIP) ;
    glColor() ;
    while(node){
      glVertex3fv(node->data->data) ;
      node = node->next ;
    }    
    glEnd() ;
    */
    }
}

void
G3DNurbsCurve::shadeDetails( void ) const
{
  glPointSize( 3 );
  glColor3f(0.2, 0.2, 0.9);
  glBegin( GL_POINTS );
  for( int i = 0; i < P.n(); ++i )
    {
      glVertex3xv( P[i].data );  //TODO 3 or 4?
    }
  glEnd();
  ((G3DNurbsCpolygon*)polygon)->shade( );
}

/*TODO
G3DNurbsCurve&
G3DNurbsCurve::operator=(const G3DNurbsCurve &a)
{
  this->NurbsCurve::operator=( a );
  this->G3DNurbs::operator=( a );
  return *this;
}
*/

G3DNurbsCurve&
G3DNurbsCurve::operator=(const PlNurbsCurvef &a)
{
  this->NurbsCurve::operator=( a );
  return *this;
}


//===================================END===================================
/*
 * Project : "MindsEye, 3D library"
 * Copyright (c) 1995 - 1997. All Rights Reserved.
 * Author(s): P. Lavoie, M. Kuball
 *
 * $Id: s_line.h,v 1.19 1998/10/11 16:07:16 source Exp $
 *

 * COPYRIGHT
 * =========
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * OVERVIEW
 * ========
 *
 */

#ifndef __S_LINE_H_
#define __S_LINE_H_

#include <nurbs.hh>
#include <curve.hh>
#include <GL/glu.h>
#include "s_nurbs.h"

using PLib::Point3Df;

//TODO is this just a Polyline, useful for other things, too ???
//class G3DPolyLine
/**This classrepresents the polygon joining
   all the control points of the NURBS curve.
   Created by: Philippe Lavoie (23 September 1997)
   */
class G3DNurbsCpolygon : public G3DObject
{
public:  
  G3DNurbsCpolygon( PlNurbsCurvef& c ) : curve(c) {};
  ~G3DNurbsCpolygon();
  /*    objectColor = cPolygonColorDefault;} */

  void shade( void ) const;

protected:
  PlNurbsCurvef& curve;

};


/**This class offers an interface to help design OpenGL 
  applications and use this NURBS library at the same time.

  A nonuniform rational B-spline (NURB) curve is a three-dimensional
  projection of a four-dimensional curve. A NURB curve is specified by its
  order, the number of control points used to define it, the control points
  themselves, and the knots used to define it. Attributes may be applied
  only to the entire NURB curve.

  Created by: Philippe Lavoie (23 September 1997)
*/
class G3DNurbsCurve : public PlNurbsCurvef, public G3DNurbs
{
  DECLARE_DYN

public:
    ///
  G3DNurbsCurve( MeFloat ) : PlNurbsCurvef(), G3DNurbs()
    {
      type_ = T_NURBS_CURVE ;  polygon = new G3DNurbsCpolygon(*this);
    };
    ///
  G3DNurbsCurve(const PlNurbsCurvef& nurb) : PlNurbsCurvef(nurb), G3DNurbs()
    {
      type_ = T_NURBS_CURVE ; polygon = new G3DNurbsCpolygon(*this);
      resetBoundingBox();
    };
    ///
  G3DNurbsCurve( const Vector_HPoint3Df& P1, const Vector_FLOAT &U1,
		 int degree=3 ): PlNurbsCurvef(P1,U1,degree), G3DNurbs()
    {
      type_ = T_NURBS_CURVE ; polygon = new G3DNurbsCpolygon(*this);
      resetBoundingBox();
    };
    ///The copy constructor.
  G3DNurbsCurve( const G3DNurbsCurve& nurb ) :
    PlNurbsCurvef((PlNurbsCurvef)nurb), G3DNurbs( nurb )
    {
      polygon = new G3DNurbsCpolygon(*this);
      resetBoundingBox();
    };

    ///
  virtual void applyTransform();
    ///
  virtual void doAction( ActionData& );
  virtual const Field* getFieldList( void ) const;
    ///
  virtual uint getParameter( Param *list );
  virtual G3DObject* getSelectionHandle_( void );
   ///
  void modifyPoint(MeFloat u, MeFloat v, MeFloat dx, MeFloat dy, MeFloat dz);
     /**utility function to draw the point C(u) on the curve.
       Input:   u --> the parametric value
                psize --> the size of the control points
	        colorP --> the color of the control points */
  void point( MeFloat &u, MeFloat &v, int pSize,
	      const G3DColor& colorP, int ) const;
    ///
  virtual void resetBoundingBox( void );
    ///generate the control point information
  //void resetCPoints();
  void resetKnots();
  void resetPolygon() {};
  virtual MeFloat selectDetails( const G3DCamera &cam, const G3DRay &ray );
    ///
  virtual void setParameter( const Param* );
    ///
  virtual void shade( int ) const;
    ///
  virtual void shadeDetails( void ) const;

    ///Copies curve a into this curve.
  //G3DNurbsCurve& operator=( const G3DNurbsCurve& a );
    ///Replace the nurbs data structure of this with a.
  G3DNurbsCurve& operator=( const PlNurbsCurvef& a );

    ///Initialise the GLUnurbsObj.
  static int  initClass( void );

protected:
  int selectionIndex_;

  static GLUnurbsObj *NurbsRenderer_;
  static float       tesselTolerance_;
  static Field       FieldList_[4];

};

#endif

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