-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc-8.0 error=class-memaccess compile failure due to memcpy in ./memtable/inlineskiplist.h #2705
Comments
@grooverdan will replace |
Sorry - wasn't sufficient. Didn't really have time to do much else about it today. ${CXX} --version + powerpc64le-unknown-linux-gnu-g++ --version powerpc64le-unknown-linux-gnu-g++ (GCC) 8.0.0 20170809 (experimental) powerpc64le-unknown-linux-gnu-g++ -m64 -O3 -g -I /opt/ibm/java/include/ -mtune=native -DROCKSDB_USE_RTTI -g -faligned-new -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -Werror -I. -I./include -std=c++11 -m64 -O3 -g -I /opt/ibm/java/include/ -mtune=native -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -m64 -O3 -g -I /opt/ibm/java/include/ -mtune=native -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=gflags -DZLIB -DBZIP2 -DLZ4 -DZSTD -DNUMA -DTBB -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -mcpu=power8 -mtune=power8 -DROCKSDB_SUPPORT_THREAD_LOCAL -DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE -isystem ./third-party/gtest-1.7.0/fused-src -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -c memtable/skiplistrep.cc -o memtable/skiplistrep.o In file included from memtable/skiplistrep.cc:6:0: ./memtable/inlineskiplist.h: In instantiation of 'void rocksdb::InlineSkipList::Node::StashHeight(int) [with Comparator = const rocksdb::MemTableRep::KeyComparator&]': ./memtable/inlineskiplist.h:599:3: required from 'rocksdb::InlineSkipList::Node* rocksdb::InlineSkipList::AllocateNode(size_t, int) [with Comparator = const rocksdb::MemTableRep::KeyComparator&; size_t = long unsigned int]' ./memtable/inlineskiplist.h:561:25: required from 'rocksdb::InlineSkipList::InlineSkipList(Comparator, rocksdb::Allocator*, int32_t, int32_t) [with Comparator = const rocksdb::MemTableRep::KeyComparator&; int32_t = int]' memtable/skiplistrep.cc:28:28: required from here ./memtable/inlineskiplist.h:281:11: error: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'struct std::atomic::Node*>' with no trivial copy-assignment [-Werror=class-memaccess] memcpy(static_cast(&next_[0]), &height, sizeof(int)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ./memtable/inlineskiplist.h:47:0, from memtable/skiplistrep.cc:6: /compiler/include/c++/8.0.0/atomic:352:12: note: 'struct std::atomic::Node*>' declared here struct atomic<_Tp*> ^~~~~~~~~~~~ cc1plus: all warnings being treated as errors |
Since this writing there are more errors under gcc 8:
|
@grooverdan @tamird feel free to send pull requests for those fixes. As @yiwu-arbug said, we don't have such environment to fix it. As long as your PR looks reasonable, we'll just merge it. |
This was fixed in #3736. |
thanks @inikep |
This is with 8.1 though: $ gcc --version
gcc (GCC) 8.1.0 |
@jonhoo are you interested in trying to fix it? We don't have access to that platform |
@ajkr this should happen with any gcc8.1 install — I don't think it's Arch Linux specific. I don't have any experience with the codebase so don't think I'm the right person to write a patch; I was just trying to compile rocksdb as a dependency :) |
If you don't like the ugly hack of a workaround I won't be offended. tested in gcc from fc28. $ gcc --version gcc (GCC) 8.1.1 20180502 (Red Hat 8.1.1-1) |
I can't reproduce you error with Ubuntu 16.04 and:
|
@inikep, try in Docker container (similar error) FROM rikorose/gcc-cmake:gcc-8
... |
#3433 has on other gcc8 fixes too. |
We depend on rocksdb too but it looks like I'm getting a similar error as @jonhoo when trying to run
I'm on Fedora Linux using gcc 8.1.1. |
Summary: Various rearrangements of the cch maths failed or replacing = '\0' with memset failed to convince the compiler it was nul terminated. So took the perverse option of changing strncpy to strcpy. Return null if memory couldn't be allocated. util/status.cc: In static member function ‘static const char* rocksdb::Status::CopyState(const char*)’: util/status.cc:28:15: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] std::strncpy(result, state, cch - 1); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ util/status.cc:19:18: note: length computed here std::strlen(state) + 1; // +1 for the null terminator ~~~~~~~~~~~^~~~~~~ cc1plus: all warnings being treated as errors make: *** [Makefile:645: shared-objects/util/status.o] Error 1 closes facebook#2705 Closes facebook#3870 Differential Revision: D8594114 Pulled By: anand1976 fbshipit-source-id: ab20f3a456a711e4d29144ebe630e4fe3c99ec25
This isn't occurring on the gcc-7-branch however the gcc master/trunk branch is enhancing its strictness
The text was updated successfully, but these errors were encountered: