<div dir="ltr">Hello,<div><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think this should be added by Clang itself.</blockquote><div><br></div><div>I don't think so. There are several sources online that indicate that developers need to <i>manually</i> specify std::nothrow. If they don't, operator new will throw an exception even if code is compiled with -fno-exception. This will abort the program.</div><div><br></div><div>At some point, this caused Firefox to replace a bunch of `new` with `new(std::nothrow)` [1] Would this be a good idea in LLVM as well? Or should we just let LLVM crash on OOM, and remove the null-checks as PVS suggests?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Or we need to use STL compiled with -fno-exceptions (libstdc++ or libc++).<br class="gmail_msg"></blockquote><div><br></div><div>Well, in this case PVS would have reported a false positive. Would it be possible to adjust PVS's <a href="http://www.viva64.com/en/w/V668/">V668</a>, so that it could detect whether std::nothrow is needed or not?</div><div><br></div><div>Best,</div><div>Jonas</div><div><br></div><div><div>[1] <a href="https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions/">https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions/</a></div><div><br></div><br class="inbox-inbox-Apple-interchange-newline"></div></div></div>