This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] warn on overflow in calls to allocation functions (bugs 77531 and 78284)


Hi,

when you add a returns_nonnull to the builtin alloca
then this code in tree-vrp.c (gimple_stmt_nonzero_warnv_p)
should go away:

         if (flag_delete_null_pointer_checks &&
             lookup_attribute ("returns_nonnull",
                               TYPE_ATTRIBUTES (gimple_call_fntype (stmt))))
           return true;
         return gimple_alloca_call_p (stmt);


Regarding __builtin_alloca_with_align, I see no test cases
for that function:

__builtin_alloca_with_align is a bit special, because it allocates
more than the first parameter says, I think it allocates (if size != 0)
size + align/8 in order to be able to return an aligned object.
What if align is very large?

I still would prefer separate -walloc-zero and -Walloca-zero
options.  Likewise for the -Walloc-larger-than and -Walloca-larger-than
or better -Wmalloc-larger-than and -Walloca-larger-than ?


Bernd.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]