Dávid Bolvanský via llvm-dev
2018-Sep-13 07:12 UTC
[llvm-dev] New warnings when building trunk with GCC 9
Hello, GCC 9.0 introduces a new warning checkers and some of them found possible issues in LLVM. In file included from /home/davidbolvansky/trunk/llvm/include/llvm/Analysis/LazyCallGraph.h:38, from /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:10: /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h: In instantiation of ‘llvm::ArrayRef<T>::ArrayRef(const std::initializer_list<_Tp>&) [with T = llvm::LazyCallGraph::Node*]’: /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:1169:52: required from here /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h:102:37: warning: initializing ‘llvm::ArrayRef<llvm::LazyCallGraph::Node*>::Data’ from ‘std::initializer_list<llvm::LazyCallGraph::Node*>::begin’ does not extend the lifetime of the underlying array [-Winit-list-lifetime] In file included from /home/davidbolvansky/trunk/llvm/unittests/ADT/SmallVectorTest.cpp:14: /home/davidbolvansky/trunk/llvm/include/llvm/ADT/SmallVector.h: In member function ‘virtual void {anonymous}::SmallVectorTest_InitializerList_Test::TestBody()’: /home/davidbolvansky/trunk/llvm/include/llvm/ADT/SmallVector.h:502:7: warning: array subscript 1 is outside array bounds of ‘int [1]’ [-Warray-bounds] 502 | ++EltPtr; /home/davidbolvansky/trunk/llvm/unittests/ADT/SmallVectorTest.cpp:994:30: note: while referencing ‘<anonymous>’ 994 | V2.insert(V2.begin() + 1, 5); /home/davidbolvansky/trunk/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp:79:40: required from here /home/davidbolvansky/trunk/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h:314:29: warning: redundant move in return statement [-Wredundant-move] 314 | return std::move(Err); In file included from /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h:75, from /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-generated-function-mockers.h:43, from /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock.h:61, from /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:17, from /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:15: /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h: In instantiation of ‘testing::internal::PredicateFormatterFromMatcher<M>::PredicateFormatterFromMatcher(M) [with M = llvm::FailedMatcher]’: /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h:1880:10: required from ‘testing::internal::PredicateFormatterFromMatcher<M> testing::internal::MakePredicateFormatterFromMatcher(M) [with M llvm::FailedMatcher]’ /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:96:3: required from here /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h:1836:75: warning: implicitly-declared ‘constexpr llvm::FailedMatcher::FailedMatcher(const llvm::FailedMatcher&)’ is deprecated [-Wdeprecated-copy] 1836 | explicit PredicateFormatterFromMatcher(M m) : matcher_(internal::move(m)) {} | ^ In file included from /home/davidbolvansky/trunk/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h:103, from /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/SupportHelpers.h:16, from /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:15, from /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:15: /home/davidbolvansky/trunk/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h:873:8: note: because ‘llvm::FailedMatcher’ has user-provided ‘void llvm::FailedMatcher::operator=(const llvm::FailedMatcher&)’ 873 | void operator=(type const &) | ^~~~~~~~ /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-generated-matchers.h:1417:5: note: in expansion of macro ‘GTEST_DISALLOW_ASSIGN_’ 1417 | GTEST_DISALLOW_ASSIGN_(name##Matcher);\ | ^~~~~~~~~~~~~~~~~~~~~~ /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:145:1: note: in expansion of macro ‘MATCHER’ 145 | MATCHER(Failed, "") { return !arg.Success(); } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180913/915698f5/attachment-0001.html>
David Blaikie via llvm-dev
2018-Sep-13 16:22 UTC
[llvm-dev] New warnings when building trunk with GCC 9
Great to see GCC catching the deprecated ctor case - would be great to get that implemented in Clang at some point (& enabled for LLVM builds). (rtrieu@) The vector one looks like a false positive? You're allowed to form a pointer to an element one past the end of a singular object but it looks like that's what GCC's warning on. Initializer list - maybe a false positive too, given ArrayRef is intended to refer to a temporary object - I think the initializer_list's lifetime is to teh end of the full expression where it was written, so this can still be OK. The ORC/redundant-move one looks correct - I wonder why Clang didn't diagnose that (rtrieu@)? On Thu, Sep 13, 2018 at 12:13 AM Dávid Bolvanský via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > GCC 9.0 introduces a new warning checkers and some of them found possible > issues in LLVM. > > In file included from > /home/davidbolvansky/trunk/llvm/include/llvm/Analysis/LazyCallGraph.h:38, > from > /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:10: > /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h: In > instantiation of ‘llvm::ArrayRef<T>::ArrayRef(const > std::initializer_list<_Tp>&) [with T = llvm::LazyCallGraph::Node*]’: > /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:1169:52: > required from here > /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h:102:37: > warning: initializing ‘llvm::ArrayRef<llvm::LazyCallGraph::Node*>::Data’ > from ‘std::initializer_list<llvm::LazyCallGraph::Node*>::begin’ does not > extend the lifetime of the underlying array [-Winit-list-lifetime] > > In file included from > /home/davidbolvansky/trunk/llvm/unittests/ADT/SmallVectorTest.cpp:14: > /home/davidbolvansky/trunk/llvm/include/llvm/ADT/SmallVector.h: In member > function ‘virtual void > {anonymous}::SmallVectorTest_InitializerList_Test::TestBody()’: > /home/davidbolvansky/trunk/llvm/include/llvm/ADT/SmallVector.h:502:7: > warning: array subscript 1 is outside array bounds of ‘int [1]’ > [-Warray-bounds] > 502 | ++EltPtr; > /home/davidbolvansky/trunk/llvm/unittests/ADT/SmallVectorTest.cpp:994:30: > note: while referencing ‘<anonymous>’ > 994 | V2.insert(V2.begin() + 1, 5); > > /home/davidbolvansky/trunk/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp:79:40: > required from here > /home/davidbolvansky/trunk/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h:314:29: > warning: redundant move in return statement [-Wredundant-move] > 314 | return std::move(Err); > > In file included from > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-spec-builders.h:75, > from > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-generated-function-mockers.h:43, > from > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock.h:61, > from > /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:17, > from > /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:15: > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h: > In instantiation of > ‘testing::internal::PredicateFormatterFromMatcher<M>::PredicateFormatterFromMatcher(M) > [with M = llvm::FailedMatcher]’: > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h:1880:10: > required from ‘testing::internal::PredicateFormatterFromMatcher<M> > testing::internal::MakePredicateFormatterFromMatcher(M) [with M > llvm::FailedMatcher]’ > /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:96:3: > required from here > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h:1836:75: > warning: implicitly-declared ‘constexpr > llvm::FailedMatcher::FailedMatcher(const llvm::FailedMatcher&)’ is > deprecated [-Wdeprecated-copy] > 1836 | explicit PredicateFormatterFromMatcher(M m) : > matcher_(internal::move(m)) {} > | > ^ > In file included from > /home/davidbolvansky/trunk/llvm/utils/unittest/googletest/include/gtest/gtest-printers.h:103, > from > /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/SupportHelpers.h:16, > from > /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:15, > from > /home/davidbolvansky/trunk/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp:15: > /home/davidbolvansky/trunk/llvm/utils/unittest/googletest/include/gtest/internal/gtest-port.h:873:8: > note: because ‘llvm::FailedMatcher’ has user-provided ‘void > llvm::FailedMatcher::operator=(const llvm::FailedMatcher&)’ > 873 | void operator=(type const &) > | ^~~~~~~~ > /home/davidbolvansky/trunk/llvm/utils/unittest/googlemock/include/gmock/gmock-generated-matchers.h:1417:5: > note: in expansion of macro ‘GTEST_DISALLOW_ASSIGN_’ > 1417 | GTEST_DISALLOW_ASSIGN_(name##Matcher);\ > | ^~~~~~~~~~~~~~~~~~~~~~ > /home/davidbolvansky/trunk/llvm/include/llvm/Testing/Support/Error.h:145:1: > note: in expansion of macro ‘MATCHER’ > 145 | MATCHER(Failed, "") { return !arg.Success(); } > > > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180913/86893f83/attachment.html>
Stephan Bergmann via llvm-dev
2018-Sep-14 07:48 UTC
[llvm-dev] New warnings when building trunk with GCC 9
On 13/09/2018 18:22, David Blaikie via llvm-dev wrote:> On Thu, Sep 13, 2018 at 12:13 AM Dávid Bolvanský via llvm-dev > <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > /home/davidbolvansky/trunk/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp:79:40: > required from here > /home/davidbolvansky/trunk/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h:314:29: > warning: redundant move in return statement [-Wredundant-move] > 314 | return std::move(Err);Note that the move (into the implicit JITSymbol(Error) ctor) is only redundant if the compiler implements a fix for <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579> "Return by converting move constructor". (But not sure whether the LLVM compiler baselines imply that, anyway. In LibreOffice it forced me to introduce ugly #ifs, to not have to disable that warning outright, <https://cgit.freedesktop.org/libreoffice/core/commit/?id=dc06c8f4989fc28d0c31ebd333e53dfe0e0f5f66> "-Werror=redundant-move (GCC 9), take two".)
Reasonably Related Threads
- [LLVMdev] [Patch] Adding unit tests to LLVM
- [LLVMdev] Any objections to my importing GoogleMock to go with GoogleTest in LLVM?
- [LLVMdev] Any objections to my importing GoogleMock to go with GoogleTest in LLVM?
- [LLVMdev] [Patch] Adding unit tests to LLVM
- [LLVMdev] Any objections to my importing GoogleMock to go with GoogleTest in LLVM?