g++ bug report

adireddy adireddy@tejasnetworks.com
Tue Oct 3 22:19:00 GMT 2000


Hello,

I was trying to compile the following program.

The following are the details:

G++ version: egcs-2.91.66
system type:Linux x86 kernel 2.2.14-12
options passed: -g

error text:

test.cc: In function `int main()':
test.cc:31: Internal compiler error.
test.cc:31: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
test.cc:31: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for details.

program:

/*---------------------------- starts here ------------------------*/
#include <ctype.h>
#include <hash_map.h>
#include <iostream.h>
#include <string.h>

static int mystrcasecmp(const char* s1, const char* s2)
{
    return(!strcasecmp(s1, s2));
}

static int gethash(const char* str)
{
    int val = 0;
    while (*str) {
        val += toupper(*str);
        str++;
    }
    return (val);
}

main () {
    typedef hash_map<char*, int, int (*) (const char*), int (*)(const char*,
const char*)> myhash;
    typedef myhash::value_type hpair;
    myhash h(10, gethash, mystrcasecmp);
    h.insert(hpair("first", 1));
    h.insert(hpair("first", 2));
    h.insert(hpair("first", 3));
    h.insert(hpair("rifst", 3));
    h.insert(hpair("second", 4));
    myhash::iterator itr = h.find("first");
    if (itr.pair)
        cout << (*itr).first << " " << (*itr).second << endl;
    itr = h.find("nfound");
    if (itr.pair != NULL)
       cout << (*itr).first << " " << (*itr).second << endl;
}

/*---------------------- ends here -----------------------------*/

Please let me know, if you need any further information.

--Adi



More information about the Gcc-bugs mailing list