8247818: GCC 10 warning stringop-overflow with symbol code

Reviewed-by: kbarrett, iklam
This commit is contained in:
Koichi Sakata 2020-07-08 11:39:11 -07:00 committed by Ioi Lam
parent 3dcd1c1ab0
commit ed31b661d3
2 changed files with 1 additions and 8 deletions

View File

@ -52,9 +52,7 @@ Symbol::Symbol(const u1* name, int length, int refcount) {
_hash_and_refcount = pack_hash_and_refcount((short)os::random(), refcount); _hash_and_refcount = pack_hash_and_refcount((short)os::random(), refcount);
_length = length; _length = length;
_body[0] = 0; // in case length == 0 _body[0] = 0; // in case length == 0
for (int i = 0; i < length; i++) { memcpy(_body, name, length);
byte_at_put(i, name[i]);
}
} }
void* Symbol::operator new(size_t sz, int len) throw() { void* Symbol::operator new(size_t sz, int len) throw() {

View File

@ -125,11 +125,6 @@ class Symbol : public MetaspaceObj {
return (int)heap_word_size(byte_size(length)); return (int)heap_word_size(byte_size(length));
} }
void byte_at_put(int index, u1 value) {
assert(index >=0 && index < length(), "symbol index overflow");
_body[index] = value;
}
Symbol(const u1* name, int length, int refcount); Symbol(const u1* name, int length, int refcount);
void* operator new(size_t size, int len) throw(); void* operator new(size_t size, int len) throw();
void* operator new(size_t size, int len, Arena* arena) throw(); void* operator new(size_t size, int len, Arena* arena) throw();