-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[BUILD] warning fix: new does not have an alignment parameter #1478
Conversation
please also check if the compiler itself is g++ as we can also use clang |
CMakeLists.txt
Outdated
@@ -78,6 +78,9 @@ else(MSVC) | |||
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11) | |||
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC ${CMAKE_C_FLAGS}") | |||
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS}") | |||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to confirm if compiler is g++, otherwise the rule is not correct fo clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tqchen I have used 'g++' compiler (cc1plus) and warnings are seen.
I verified build with 'clang' and not seen the these warnings.
Shall I add check for 'g++' here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please only trigger this flag when compiler is g++
Thanks @joyalbin ! This is now merged |
The below warning is shown with environment GCC 7.2 and -std=c++11
This PR will fix the below warnings tvm/vta/src/sim/sim_driver.cc: In constructor _vta::sim::DRAM::Page::Page(size_t, size_t)_: tvm/vta/src/sim/sim_driver.cc:196:33: warning: _new_ of type _vta::sim::DRAM::Page::DType {aka std::aligned_storage<4096, 256> ::type}_ with extended alignment 256 [-Waligned-new=] data = new DType[num_pages]; ^ tvm/vta/src/sim/sim_driver.cc:196:33: note: uses _void* operator new [](std::size_t)_, which does not have an alignment parameter tvm/vta/src/sim/sim_driver.cc:196:33: note: use _-faligned-new_ to enable C++17 over-aligned new support tvm/vta/src/sim/sim_driver.cc: In instantiation of _vta::sim::SRAM<kBits, kLane, kMaxNumElem>::SRAM() [with int kBits = 8; int kLane = 256; int kMaxNumElem = 1024]_: tvm/vta/src/sim/sim_driver.cc:345:12: required from here tvm/vta/src/sim/sim_driver.cc:226:13: warning: _new_ of type _vta::sim::SRAM<8, 256, 1024>::DType {aka std::aligned_storage<25 6, 256>::type}_ with extended alignment 256 [-Waligned-new=] data_ = new DType[kMaxNumElem]; ^~~~~~~~~~~~~~~~~~~~~~ tvm/vta/src/sim/sim_driver.cc:226:13: note: uses _void* operator new [](std::size_t)_, which does not have an alignment parameter tvm/vta/src/sim/sim_driver.cc:226:13: note: use _-faligned-new_ to enable C++17 over-aligned new support tvm/vta/src/sim/sim_driver.cc: In instantiation of _vta::sim::SRAM<kBits, kLane, kMaxNumElem>::SRAM() [with int kBits = 32; in t kLane = 16; int kMaxNumElem = 2048]_: tvm/vta/src/sim/sim_driver.cc:345:12: required from here tvm/vta/src/sim/sim_driver.cc:226:13: warning: _new_ of type _vta::sim::SRAM<32, 16, 2048>::DType {aka std::aligned_storage<64 , 64>::type}_ with extended alignment 64 [-Waligned-new=] tvm/vta/src/sim/sim_driver.cc:226:13: note: uses _void* operator new [](std::size_t)_, which does not have an alignment parameter tvm/vta/src/sim/sim_driver.cc:226:13: note: use _-faligned-new_ to enable C++17 over-aligned new support
This PR will avoid the issue
Reference: https://github.com/google/flatbuffers/pull/4621/files