Eugene Zelenko via llvm-dev
2016-Oct-31 17:48 UTC
[llvm-dev] PVS-Studio analysis of LLVM code
Hi! Company behind PVS-Studio analyzed relatively recent version of LLVM and some results are reported in http://www.viva64.com/en/b/0446/. Eugene.
Jonas Wagner via llvm-dev
2016-Nov-01 10:26 UTC
[llvm-dev] PVS-Studio analysis of LLVM code
Hi Eugene, I think this is really cool! You've convinced me to try out PVS on some of my own projects :) Of all the warnings presented in the article, there was one for which I thought it's a false positive. By default, LLVM is compiled without RTTI and exceptions. Because of this, I reasoned that operator new would not throw an exception, and so the checks of its result against nullptr were correct... right? Turns out I'm probably wrong. At least according to this stack overflow post <https://stackoverflow.com/questions/6049563/with-fno-exceptions-what-happens-with-new-t>. But then, what is the correct way to use operator new when compiling with -fno-exceptions? Do we need to add (std::nothrow) to all uses of `new`? Best, Jonas On Mon, Oct 31, 2016 at 6:49 PM Eugene Zelenko via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi! > > Company behind PVS-Studio analyzed relatively recent version of LLVM > and some results are reported in http://www.viva64.com/en/b/0446/. > > Eugene. > _______________________________________________ > 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/20161101/0e55bea7/attachment.html>
Eugene Zelenko via llvm-dev
2016-Nov-01 17:38 UTC
[llvm-dev] PVS-Studio analysis of LLVM code
Hi, Jonas! On Tue, Nov 1, 2016 at 3:26 AM, Jonas Wagner <jonas.wagner at epfl.ch> wrote:> Hi Eugene, > > I think this is really cool! You've convinced me to try out PVS on some of > my own projects :) > > Of all the warnings presented in the article, there was one for which I > thought it's a false positive. By default, LLVM is compiled without RTTI and > exceptions. Because of this, I reasoned that operator new would not throw an > exception, and so the checks of its result against nullptr were correct... > right? > > Turns out I'm probably wrong. At least according to this stack overflow > post. But then, what is the correct way to use operator new when compiling > with -fno-exceptions? Do we need to add (std::nothrow) to all uses of `new`?I think this should be added by Clang itself. Or we need to use STL compiled with -fno-exceptions (libstdc++ or libc++).> Best, > JonasEugene.
Apparently Analagous Threads
- PVS-Studio analysis of LLVM code
- PVS-Studio analysis of LLVM code
- clang-tidy : Modify cert-err60-cpp configuration
- [PATCH 4/5] daemon: lvm: list PVs/VGs/LVs with --foreign
- [LLVMdev] why we assume malloc() always returns a non-null pointer in instruction combing?