diff options
Diffstat (limited to 'malloc/tst-malloc.c')
-rw-r--r-- | malloc/tst-malloc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c index c1292a24f8..aa1aa2aa41 100644 --- a/malloc/tst-malloc.c +++ b/malloc/tst-malloc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2016 Free Software Foundation, Inc. +/* Copyright (C) 1999-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1999. @@ -19,6 +19,7 @@ #include <errno.h> #include <malloc.h> #include <stdio.h> +#include <libc-diag.h> static int errors = 0; @@ -37,7 +38,14 @@ do_test (void) errno = 0; + DIAG_PUSH_NEEDS_COMMENT; +#if __GNUC_PREREQ (7, 0) + /* GCC 7 warns about too-large allocations; here we want to test + that they fail. */ + DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than="); +#endif p = malloc (-1); + DIAG_POP_NEEDS_COMMENT; save = errno; if (p != NULL) @@ -67,7 +75,14 @@ do_test (void) if (p == NULL) merror ("malloc (513K) failed."); + DIAG_PUSH_NEEDS_COMMENT; +#if __GNUC_PREREQ (7, 0) + /* GCC 7 warns about too-large allocations; here we want to test + that they fail. */ + DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than="); +#endif q = malloc (-512 * 1024); + DIAG_POP_NEEDS_COMMENT; if (q != NULL) merror ("malloc (-512K) succeeded."); |