PR c/78668 - aligned_alloc, realloc, et al. missing attribute alloc_size
authorMartin Sebor <msebor@redhat.com>
Sun, 4 Dec 2016 17:48:44 +0000 (17:48 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Sun, 4 Dec 2016 17:48:44 +0000 (10:48 -0700)
commit5dcf45618031c9d0e44ba306102a6562eed879d3
treea2b92f8621a6149627fede384c04f7664300a214
parent6b7d84532342ed038a07d850ddacf7a86106a998
PR c/78668 - aligned_alloc, realloc, et al. missing attribute alloc_size

gcc/ChangeLog:

PR c/78668
        * builtin-attrs.def (ATTR_ALLOC_SIZE, ATTR_RETURNS_NONNULL): New
        identifier tree nodes.
        (ATTR_ALLOCA_SIZE_1_NOTHROW_LEAF_LIST): New attribute list.
        (ATTR_MALLOC_SIZE_1_NOTHROW_LIST): Same.
        (ATTR_MALLOC_SIZE_1_NOTHROW_LEAF_LIST): Same.
        (ATTR_MALLOC_SIZE_1_2_NOTHROW_LEAF_LIST): Same.
        (ATTR_ALLOC_SIZE_2_NOTHROW_LEAF_LIST): Same.
        * builtins.def (aligned_alloc, calloc, malloc, realloc):
        Add attribute alloc_size.
        (alloca): Add attribute alloc_size and returns_nonnull.

gcc/testsuite/ChangeLog:

PR c/78668
* gcc.dg/builtin-alloc-size.c: New test.

From-SVN: r243231
gcc/ChangeLog
gcc/builtin-attrs.def
gcc/builtins.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/builtin-alloc-size.c [new file with mode: 0644]