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

hash_map and -frepo problems


<hash_map> gives unresolved symbols when used with -frepo.  <hash_map>
works fine when used without -frepo.

Included at the end of this file is a single source file and a Makefile
which builds it four different ways: with and without -frepo; once with
<hash_map>, and once with <map>.

Looking at the ChangeLog for libstc++/stl I see that the same bugs I reported
earlier have been fixed over and over again by several others but keep
getting lost everytime stl is updated to SGI's latest version.  Isn't CVS
supported to allow you to track third party sources like this?

BTW: I get a much smaller set of unresolved symbols when I use the
Moscow Center for SPARC Technology's SGI STL Adaptation.  Their adaptation
also fixes many of the small bugs I've already reported.

Greg
----
Gregory L. Galloway
Research Scientist I

http://eoeml.gtri.gatech.edu/home/gregg/

--------makefile-------------------------------------------------------------
all: hmtest-no-frepo hmtest-frepo mtest-no-frepo mtest-frepo

hmtest-no-frepo: hmtest.cc
	g++ -c hmtest.cc -o hmtest-no-frepo.o
	g++ -o hmtest-no-frepo hmtest-no-frepo.o

hmtest-frepo: hmtest.cc
	g++ -frepo -c hmtest.cc -o hmtest-frepo.o
	- g++ -frepo -o hmtest-frepo hmtest-frepo.o

mtest-no-frepo: hmtest.cc
	g++ -DUSE_MAP -c hmtest.cc -o mtest-no-frepo.o
	g++ -o mtest-no-frepo mtest-no-frepo.o

mtest-frepo: hmtest.cc
	g++ -frepo -DUSE_MAP -c hmtest.cc -o mtest-frepo.o
	g++ -frepo -o mtest-frepo mtest-frepo.o

clean:
	rm -f *.o *.rpo hmtest-no-frepo hmtest-frepo mtest-no-frepo mtest-frepo
--------hmtest.cc------------------------------------------------------------
#include <iostream.h>
#include <string>

#ifdef USE_MAP

#include <map>

typedef map<string, int, less<string> > map_t;

#else

#include <hash_map>

struct hash<string>
{
  size_t operator()(const string& s) const
    { return __stl_hash_string(s.c_str()); }
};

typedef hash_map<string, int, hash<string>, equal_to<string> > map_t;

#endif

static char *keywords[] = {
  "break",
  "case",
  "const",
  "continue",
  "default",
  "delete",
  "do",
  "else",
  "eval",
  "exit",
  "false",
  "for",
  "function",
  "if",
  "in",
  "include",
  "return",
  "source",
  "switch",
  "true",
  "while",
  0
};

void main()
{
  map_t m;

  int i = 0;
  for (char **p = keywords; *p != NULL; ++p, ++i) {
    m[*p] = i;
  }

  for (map_t::iterator it = m.begin(); it != m.end(); ++it) {
    cout << (*it).first << " => " << (*it).second << endl;
  }
}
--------make output when building with egcs-971016---------------------------
g++ -c hmtest.cc -o hmtest-no-frepo.o
g++ -o hmtest-no-frepo hmtest-no-frepo.o
g++ -frepo -c hmtest.cc -o hmtest-frepo.o
g++ -frepo -o hmtest-frepo hmtest-frepo.o
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking
hmtest-frepo.o: In function `vector<__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *, __default_alloc_template<false, 0> >::insert(__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, unsigned int, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *const &)':
hmtest-frepo.o(.text+0x160): undefined reference to `void fill<__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *>(__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > * const &)'
hmtest-frepo.o(.text+0x1c7): undefined reference to `void fill<__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *>(__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > * const &)'
hmtest-frepo.o: In function `__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > ** __uninitialized_fill_n_aux<__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, unsigned int, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *>(__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, unsigned int, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > * const &, __true_type)':
hmtest-frepo.o(.gnu.linkonce.t.__uninitialized_fill_n_aux__H3ZPPt16__hashtable_node1Zt4pair2ZCt12basic_string2ZcZt18string_char_traits1ZcZiZUiZPt16__hashtable_node1Zt4pair2ZCt12basic_string2ZcZt18string_char_traits1ZcZi_X01X11RCX21G11__true_type_X01+0x16): undefined reference to `__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > ** fill_n<__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, unsigned int, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > *>(__hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > **, unsigned int, __hashtable_node<pair<basic_string<char, string_char_traits<char> > const, int> > * const &)'
hmtest-frepo.o: In function `unsigned long const * lower_bound<unsigned long const *, unsigned long>(unsigned long const *, unsigned long const *, unsigned long const &)':
hmtest-frepo.o(.unsigned long const * gnu.linkonce.t.lower_bound<unsigned long const *, unsigned long>(unsigned long const *, unsigned long const *, unsigned long const &)+0x3f): undefined reference to `unsigned long const * __lower_bound<unsigned long const *, unsigned long, int>(unsigned long const *, unsigned long const *, unsigned long const &, int *, random_access_iterator_tag)'
collect2: ld returned 1 exit status
make: [hmtest-frepo] Error 1 (ignored)
g++ -DUSE_MAP -c hmtest.cc -o mtest-no-frepo.o
g++ -o mtest-no-frepo mtest-no-frepo.o
g++ -frepo -DUSE_MAP -c hmtest.cc -o mtest-frepo.o
g++ -frepo -o mtest-frepo mtest-frepo.o
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking
--------make output when building with egcs-971016 and sgi stl adapatation-----
g++ -c hmtest.cc -o hmtest-no-frepo.o
g++ -o hmtest-no-frepo hmtest-no-frepo.o
g++ -frepo -c hmtest.cc -o hmtest-frepo.o
g++ -frepo -o hmtest-frepo hmtest-frepo.o
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking
hmtest-frepo.o: In function `unsigned long const * lower_bound<unsigned long const *, unsigned long>(unsigned long const *, unsigned long const *, unsigned long const &)':
hmtest-frepo.o(.unsigned long const * gnu.linkonce.t.lower_bound<unsigned long const *, unsigned long>(unsigned long const *, unsigned long const *, unsigned long const &)+0x3f): undefined reference to `unsigned long const * __lower_bound<unsigned long const *, unsigned long, int>(unsigned long const *, unsigned long const *, unsigned long const &, int *, random_access_iterator_tag)'
collect2: ld returned 1 exit status
make: [hmtest-frepo] Error 1 (ignored)
g++ -DUSE_MAP -c hmtest.cc -o mtest-no-frepo.o
g++ -o mtest-no-frepo mtest-no-frepo.o
g++ -frepo -DUSE_MAP -c hmtest.cc -o mtest-frepo.o
g++ -frepo -o mtest-frepo mtest-frepo.o
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking
collect: recompiling hmtest.cc
collect: relinking


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