[llvm-dev] PVS-Studio analysis of LLVM code
Eugene Zelenko via llvm-dev
llvm-dev at lists.llvm.org
Tue Nov 1 10:38:05 PDT 2016
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...
> 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++).
More information about the llvm-dev