This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95.2 wants me to submit an bug report.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95.2 wants me to submit an bug report.
- From: Gunter <Gunter dot B dot C dot Koenigsmann at e-technik dot stud dot uni-erlangen dot de>
- Date: Wed, 5 Jul 2000 17:14:53 +0200 (MEST)
- Reply-To: Gunter Königsmann <gunter dot koenigsmann at gmx dot de>
g++ -Wall -ggdb -lm -lstdc++ -ggdb wordcount.cc -o wordcount
/usr/include/g++/stl_map.h:76: Internal compiler error in
`output_die', at dwarf2out.c:5426
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make: *** [wordcount] Error 1
5.200u 0.110s 0:05.31 100.0% 0+0k 0+0io 917pf+0w
The line that produces the error message is line #154
if((s=getword(f))!="")
... I have this problem frequently, but this time it seems to occur
under reproducable circumstances.
(Using a SuSE Linux 6.3/PPro- system.)
--
Gunter.
This fortune cookie program out of order. For those in desperate need,
please use the program "randchar". This program generates random
characters, and, given enough time, will undoubtedly come up with
something profound.
---fortune(6)
#include<iostream>
#include<fstream>
#include<unistd.h>
#include<stdio.h>
#include<string>
#include<map>
class strlist{ /* Eine Klasse sortierter Strings */
char nextchar(istream&f)
{
char c;
if(!f.get(c))return(0); /* Zeichen lesen, bei EOF Stringende
liefern */
if((c=='ä')||(c=='ö')||(c=='ü')||(c=='ß')||
(c=='Ä')||(c=='Ö')||(c=='Ü'))
return(c);
if((c>='a')&&(c<='z')||
(c>='A')&&(c<='Z'))
return(c);
return(0);
}
string& getword(istream &f)
{
static string a;
char c;
a="";
while((c=nextchar(f)))
a=a+c;
return(a);
}
protected:
map<int,string>word;
map<int,string>upcaseword;
int last;
map<int,int>num;
int isthere(string); /* Ist ein String schon registriert? */
void add(string);
private:
public:
strlist(){last=0;};
inline ~strlist(){};
string operator[](int n)
{return(word[n]);};
int n(int n)
{return(num[n]);};
void pushback(string);
int len(){return(last);};
int readfile(char *);
};
void strlist::add(string s) /* Fügt einen neuen String an der
Richtigen Stelle hinzu */
{
int i=0,o;
unsigned u;
string ups="";
for(u=0;u<s.length();u++)
ups+=toupper(s[u]);
while((i<=last)&&(ups<upcaseword[i]))
i++;
for(o=last;o>i;--o)
{
upcaseword[o]=upcaseword[o-1];
word[o]=word[o-1];
num [o]=num [o-1];
}
word[i]=s;
num [i]=1;
upcaseword[i]=ups;
last++;
}
int strlist::isthere(string s) /* Schnelles Verfahren für große
sortierte Liste: Habe vor, das
Programm wirklich zu verwenden ;-)
...liefert -1, wenn s nicht gefunden
wurde. */
{
int i=last/2;
int o=(i/2)<(1)?(1):(i/2);
unsigned u;
for(u=0;u<s.length();u++)
s[u]=toupper(s[u]);
while(o>1)
{
if(s<upcaseword[i])i+=o;
else if(s==upcaseword[i])return(i);
else i-=o;
o=o/2;
}
if(s>upcaseword[i])
while((s>upcaseword[i])&&(i>0))
i--;
else
while((s<upcaseword[i])&&(i<last-1))
i++;
if(s==upcaseword[i])return(i);
else
return(-1);
}
void strlist::pushback(string s)
{
int i;
ifstream f;
if((i=isthere(s))!=-1)
{
num[i]++;
if(s>word[i]) word[i]=s; /* Wenn ein Wort einmal klein und
einmal groß geschrieben wurde,
ist es kein substantiv, und
sollte daher klein ausgedruckt
werden. */
}
else
add(s);
}
int strlist::readfile(char *name)
{
ifstream f;
string s;
f.open(name);
if(f.bad())
{
cerr<<"Couldn't open "<<*name<<"For reading. Aborting\n";
exit(-1);
}
while(!f.eof())
if((s=getword(f))!="")
pushback(s);
f.close();
return(0);
}
int main(int argc,char **argv)
{
ofstream o;
strlist l;
int i;
argv++;
l.readfile(*argv);
o.open(*(++argv),ios::noreplace); /* Better not delete
files on the
corrector's pc ;-)*/
if(o.bad())
{
cerr<<"Couldn't create "<<*argv<<". Aborting\n";
exit(-1);
}
for(i=l.len();i>0;i--)
{
o.width(4);
o <<l.n(i-1)<<"X "<<l[i-1]<<'\n';
}
return(0);
}