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 Err



// To: egcs-bugs@cygnus.com
// Subject: Internal compiler error


// Hello,

// I tried to compile the following code (it was written by Todd Veldhuizen
// <tveldhui@monet.uwaterloo.ca>).


template<double functionToIntegrate(double)>
double integrate(double a, double b, int numSamplePoints)
{
  //    PRECONDITION(numSamplePoints > 1);
    double delta = (b-a) / (numSamplePoints-1);
    double sum = 0.;
    for (int i=0; i < numSamplePoints; ++i)
        sum += functionToIntegrate(a + i*delta);
    return sum * (b-a) / numSamplePoints;
}

inline double myFunction(double x)
{
    return 1 / (1 + x);
}

// Example use
void main() {
double z = integrate<myFunction>(0.0, 1.0, 50);
}


// and this is the result :
//   g++ fexpr.cpp 
//   fexpr.cpp: In function `int main(...)':
//   fexpr.cpp:20: Internal compiler error.
//   fexpr.cpp:20: Please submit a full bug report to `egcs-bugs@cygnus.com'.


// My working environment 

// uname -s -r
// Linux 2.0.18

// g++ -v
// Reading specs from
/usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.21/specs
// gcc version egcs-2.90.21 971202 (egcs-1.00 release)


// Hope that helps 
// 
// Best regards
// Burkhard Neppert
// burkhard.neppert@bbs.vobis.de


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