[PATCH] [analyzer] Assume new returns non-null even under -fno-exceptions

Anna Zaks ganna at apple.com
Tue Aug 27 09:12:07 PDT 2013


Pavel,

Please update the comment, otherwise LGTM.

Anna.

On Aug 27, 2013, at 5:05 AM, Pavel Labath <labath at google.com> wrote:

> Hi jordan_rose,
> 
> -fno-exceptions does not implicitly attach a nothrow specifier to every operator
> new. Even in this mode, non-nothrow new must not return a null pointer. Failure
> to allocate memory can be signalled by other means, or just by killing the
> program. This behaviour is consistent with the compiler - even with
> -fno-exceptions, the generated code never tests for null (and would segfault if
> the opeator actually happened to return null).
> 
> http://llvm-reviews.chandlerc.com/D1528
> 
> Files:
>  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
>  test/Analysis/NewDelete-path-notes.cpp
>  test/Analysis/new-with-exceptions.cpp
> <D1528.1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list