> Hi.
> 
> Following patch implements new predictors that annotates malloc-like 
> functions.
> These almost every time return a non-null value.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> gcc/ChangeLog:
> 
> 2018-07-26  Martin Liska  <mli...@suse.cz>
> 
>         PR middle-end/83023
>       * predict.c (expr_expected_value_1): Handle DECL_IS_MALLOC
>         declarations.
>       * predict.def (PRED_MALLOC_NONNULL): New predictor.
> 
> gcc/testsuite/ChangeLog:
> 
> 2018-07-26  Martin Liska  <mli...@suse.cz>
> 
>         PR middle-end/83023
>       * gcc.dg/predict-16.c: New test.

These are two conceptually different things - wether you return new memory
and whether the return value is commonly non-null. While it goes together
for majority of malloc function I wonder if this is safe WRT the auto-detected
malloc attributes.  I do not know how common is code that returns new memory
only under some conditions?  

Honza

Reply via email to