g++ egcs-1.1a internal compiler error
JHB NIJHOF
j.h.b.nijhof@aston.ac.uk
Wed Sep 2 08:54:00 GMT 1998
egcs-1.1a's g++ reports an 'internal compiler error' on my
Debian 1.3 (libc5) system; I got the same error message for
a recent snapshot on Debian 2.0 (glibc).
Version of g++ (g++ -V): egcs-2.91.57
Operating system: Debian Linux 1.3
egcs was configured as follows (== config.status):
#!/bin/sh
# This file was generated automatically by configure. Do not edit.
# This directory was configured as follows:
../egcs-1.1a/configure \
--with-gcc-version-trigger=/home/nijhojhb/src/egcs-1.1a/gcc/version.c \
--host=i686-pc-linux-gnulibc1 --prefix=/usr/local/egcs --enable-shared \
--enable-version-specific-runtime-libs --norecursion
# using "mh-frag" and "mt-frag"
What follows is the cc-file ('bug.cc') that produces the error.
Currently, line 72, marked "// BUG 1"
is commented out; with that line included, an error occurs on that
line:
bug.cc:72: sorry, not implemented: testing field_decl for template parms
bug.cc: In method `Field::Field(const class string &, int = 0)':
bug.cc:72: confused by earlier errors, bailing out
But with that line commented out, an internal compiler error occurs
on line 82:
bug.cc: In method `Field::Field(const class string &, int = 0)':
bug.cc:82: Internal compiler error.
bug.cc:82: Please submit a full bug report to `egcs-bugs@cygnus.com'.
Yours,
Jeroen Nijhof
-----------------------------------------------------------------------------
// bug.cc
#include <stdlib.h>
#include <iostream.h>
#include <complex>
typedef complex<double> Complex;
#include <algorithm>
#include <numeric>
#include <vector>
#include <math.h>
#include <fstream.h>
#include <string>
// typedefs.h
typedef vector<Complex> cvector;
typedef vector<double> dvector;
// my_error.h
// this could perhaps be simplified with templates,
// but for now I'll define all variants I need
void my_error(string s, int n, string s2="");
void my_error(string s, string s2="", string s3="");
void my_error(string s, char c);
// Field.h
class Field {
public:
Field() : npts(0) {}
Field(const string& filename, int frameno = 0); // restart()
int npts;
double p;
cvector u;
double z;
};
Field::Field(const string& filename, int frame_no)
{
// .....Load a field profile from "file". If "frame_no" is set to zero,
// then the last frame in the file is loaded, otherwise the
// "frame_no"th frame is taken
int n;
float x;
ifstream infile(filename.c_str());
if (!infile) my_error("Could not open unformatted data file " +filename);
infile.read(&n,4);
if (n != 36)
my_error("Unformatted data file " +filename + " has a corrupt header");
infile.read(&npts,4);
infile.read(&x,4);
p = x;
u = cvector(2*npts);
float floatarray[4 * npts + 1];
char scratch[28];
infile.read(scratch,28); //large enough
infile.read(&n,4);
if (!infile || n != 36)
my_error("Unformatted data file " + filename + " has a corrupt header");
int arraylength = 16 * npts + 4;
if (frame_no) {
while (frame_no--) {
infile.read(&n,4); // blockcount start of frame
if (!infile || n != arraylength)
my_error("File " + filename + " is ", frame_no + 1, " frames short");
// infile.read(floatarray,arraylength); // BUG 1
infile.read(&n,4); // blockcount end of frame
if (!infile || n != arraylength)
my_error("File " + filename + " is ", frame_no + 1, " frames short");
}
} else {
infile.read(&n,4); // blockcount start of frame
while (infile) {
if (n != arraylength)
my_error("Failed to fine last frame in " + filename);
infile.read(floatarray,arraylength); // BUG 2
infile.read(&n,4); // blockcount end of frame
if (!infile || n != arraylength)
my_error("Failed to fine last frame in " + filename);
infile.read(&n,4); // blockcount start of frame
}
}
z=floatarray[0];
float * const rax = &floatarray[1];
for (int i = 0; i < 2*npts ; i++) {
u[i] =Complex(rax[2*i], rax[2*i+1]);
}
p return;
} // restart
More information about the Gcc-bugs
mailing list