This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.24-613-g3d7229c
- From: jsm28 at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 4 Jan 2017 23:32:33 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.24-613-g3d7229c
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 3d7229c2507be1daf0c3e15e1f134076fa8b9025 (commit)
from 179b86750caeb0a0a4798830d6d52a00dc70db2d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3d7229c2507be1daf0c3e15e1f134076fa8b9025
commit 3d7229c2507be1daf0c3e15e1f134076fa8b9025
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Jan 4 23:32:14 2017 +0000
Fix malloc/ tests for GCC 7 -Walloc-size-larger-than=.
GCC 7 has a -Walloc-size-larger-than= warning for allocations of half
the address space or more. This causes errors building glibc tests
that deliberately test failure of very large allocations. This patch
arranges for this warning to be ignored around the problematic
function calls.
Tested compilation for aarch64 (GCC mainline) with
build-many-glibcs.py; did execution testing for x86_64 (GCC 5).
* malloc/tst-malloc.c: Include <libc-internal.h>.
(do_test): Disable -Walloc-size-larger-than= around tests of
malloc with negative sizes.
* malloc/tst-mcheck.c: Include <libc-internal.h>.
(do_test): Disable -Walloc-size-larger-than= around tests of
malloc and realloc with negative sizes.
* malloc/tst-realloc.c: Include <libc-internal.h>.
(do_test): Disable -Walloc-size-larger-than= around tests of
realloc with negative sizes.
diff --git a/ChangeLog b/ChangeLog
index 8770c65..a3eacbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2017-01-04 Joseph Myers <joseph@codesourcery.com>
+ * malloc/tst-malloc.c: Include <libc-internal.h>.
+ (do_test): Disable -Walloc-size-larger-than= around tests of
+ malloc with negative sizes.
+ * malloc/tst-mcheck.c: Include <libc-internal.h>.
+ (do_test): Disable -Walloc-size-larger-than= around tests of
+ malloc and realloc with negative sizes.
+ * malloc/tst-realloc.c: Include <libc-internal.h>.
+ (do_test): Disable -Walloc-size-larger-than= around tests of
+ realloc with negative sizes.
+
* math/libm-test.inc (TEST_COND_ibm128_libgcc): New macro.
(init_max_error) [TEST_COND_ibm128]: Increase maximum error
allowed to 16 ulps.
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
index e756102..740ac6c 100644
--- a/malloc/tst-malloc.c
+++ b/malloc/tst-malloc.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
+#include <libc-internal.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.");
diff --git a/malloc/tst-mcheck.c b/malloc/tst-mcheck.c
index 73a497f..2e3cba9 100644
--- a/malloc/tst-mcheck.c
+++ b/malloc/tst-mcheck.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libc-internal.h>
static int errors = 0;
@@ -36,7 +37,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;
if (p != NULL)
merror ("malloc (-1) succeeded.");
@@ -67,10 +75,17 @@ do_test (void)
if (p == NULL)
merror ("malloc (512) 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
if (realloc (p, -256) != NULL)
merror ("realloc (p, -256) succeeded.");
else if (errno != ENOMEM)
merror ("errno is not set correctly.");
+ DIAG_POP_NEEDS_COMMENT;
free (p);
@@ -78,10 +93,17 @@ do_test (void)
if (p == NULL)
merror ("malloc (512) 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
if (realloc (p, -1) != NULL)
merror ("realloc (p, -1) succeeded.");
else if (errno != ENOMEM)
merror ("errno is not set correctly.");
+ DIAG_POP_NEEDS_COMMENT;
free (p);
free (q);
diff --git a/malloc/tst-realloc.c b/malloc/tst-realloc.c
index 53182b3..7f1f228 100644
--- a/malloc/tst-realloc.c
+++ b/malloc/tst-realloc.c
@@ -19,6 +19,7 @@
#include <malloc.h>
#include <stdio.h>
#include <string.h>
+#include <libc-internal.h>
static int errors = 0;
@@ -39,7 +40,14 @@ do_test (void)
errno = 0;
/* realloc (NULL, ...) behaves similarly to malloc (C89). */
+ 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 = realloc (NULL, -1);
+ DIAG_POP_NEEDS_COMMENT;
save = errno;
if (p != NULL)
@@ -111,7 +119,14 @@ do_test (void)
merror ("first 16 bytes were not correct");
/* Check failed realloc leaves original untouched (C89). */
+ 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
c = realloc (p, -1);
+ DIAG_POP_NEEDS_COMMENT;
if (c != NULL)
merror ("realloc (p, -1) succeeded.");
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 10 ++++++++++
malloc/tst-malloc.c | 15 +++++++++++++++
malloc/tst-mcheck.c | 22 ++++++++++++++++++++++
malloc/tst-realloc.c | 15 +++++++++++++++
4 files changed, 62 insertions(+), 0 deletions(-)
hooks/post-receive
--
GNU C Library master sources