GCC 8 reports errors like following:
== Excess strncat limits ==
src/hotspot/share/adlc/dfa.cpp:724:14: error: 'char* strncat(char*, const char*, size_t)' specified bound 2048 equals destination size [-Werror=stringop-overflow=]
strncat(string_buffer, "+", STRING_BUFFER_LENGTH);
Buffers are declared like:
So all such usages should use "STRING_BUFFER_LENGTH - 1".
src/hotspot/share/classfile/classLoader.cpp:1233:53: error: argument to ���sizeof��� in ���char* strncpy(char*, const char*, size_t)��� call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
strncpy(&file_name[class_name_len], class_suffix, sizeof(class_suffix));
class_suffix already includes NULL and strncpy adds one more, so it looks like there also should be " - 1".
== Class arrays zeroing ===
In multiple places there are errors reported like:
src/hotspot/share/services/memoryManager.cpp:172:40: error: ���void* memset(void*, int, size_t)��� clearing an object of non-trivial type ���class MemoryUsage���; use assignment or value-initialization instead [-Werror=class-memaccess]
memset(_before_gc_usage_array, 0, len);
Can be fixed by casting to void*.