FULL PRODUCT VERSION :
FULL OS VERSION :
Linux Fedora17 3.4.2-4.fc17.x86_64 #1 SMP Thu Jun 14 22:22:05 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
gcc-4.7.0-5.fc17.x86_64
gcc-c++-4.7.0-5.fc17.x86_64
A DESCRIPTION OF THE PROBLEM :
When I try to build JDK8 with Native Memory Tracking (CR#6995781 / 7151532) with GCC 4.7.0 on Fedora17, it fails with message as following.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
REGRESSION. Last worked in version 7
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build JDK8 with GCC 4.7.0
ERROR MESSAGES/STACK TRACES THAT OCCUR :
/usr/src/OpenJDK/8/test/jdk8/hotspot/src/share/vm/utilities/hashtable.hpp: In instantiation of 'int Hashtable<T, F>::index_for(Symbol*) [with T = constantPoolOopDesc*; short unsigned int F = 256u]':
/usr/src/OpenJDK/8/test/jdk8/hotspot/src/share/vm/utilities/hashtable.cpp:317:16: required from here
/usr/src/OpenJDK/8/test/jdk8/hotspot/src/share/vm/utilities/hashtable.hpp:263:44: error: 'hash_to_index' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/usr/src/OpenJDK/8/test/jdk8/hotspot/src/share/vm/utilities/hashtable.hpp:263:44: note: declarations in dependent base 'BasicHashtable<256u>' are not found by unqualified lookup
/usr/src/OpenJDK/8/test/jdk8/hotspot/src/share/vm/utilities/hashtable.hpp:263:44: note: use 'this->hash_to_index' instead
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
We have to explicit reference of C++ class member.
Bug 43282 - GCC looks into dependent bases during unqualified lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43282
comment #4:
-----------
You have to add "this->" or "Bar::" to use another form of lookup (qualified or class-member access) or use a using-declaration to bring the name in scope ("using HasFoo<T>::foo;").
-----------
Patch submitted by originator - ###@###.###
diff -r e3619706a725 src/share/vm/utilities/hashtable.cpp
--- a/src/share/vm/utilities/hashtable.cpp Mon Jul 23 12:38:08 2012 -0700
+++ b/src/share/vm/utilities/hashtable.cpp Tue Jul 24 14:29:30 2012 +0900
@@ -135,7 +135,7 @@
// walking the hashtable past these entries requires
// BasicHashtableEntry::make_ptr() call.
bool keep_shared = p->is_shared();
- unlink_entry(p);
+ this->unlink_entry(p);
new_table->add_entry(index, p);
if (keep_shared) {
p->set_shared();
diff -r e3619706a725 src/share/vm/utilities/hashtable.hpp
--- a/src/share/vm/utilities/hashtable.hpp Mon Jul 23 12:38:08 2012 -0700
+++ b/src/share/vm/utilities/hashtable.hpp Tue Jul 24 14:29:30 2012 +0900
@@ -260,7 +260,7 @@
}
int index_for(Symbol* name) {
- return hash_to_index(compute_hash(name));
+ return this->hash_to_index(compute_hash(name));
}
// Table entry management