diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-07-05 11:43:05 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-07-05 11:43:05 +0000 |
| commit | f41d8b3fa92a8c3a34fad20f3e5330bcc9e9518a (patch) | |
| tree | 7922397ee16874ffdedb652aed61ff94ca7adbf0 | |
| parent | 00d31836f19a7d36e1ee546528bc6a5822270f1f (diff) | |
t_posix_memalign: Fix this to reflect restriction lifted in C17.
| -rw-r--r-- | tests/lib/libc/stdlib/t_posix_memalign.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/lib/libc/stdlib/t_posix_memalign.c b/tests/lib/libc/stdlib/t_posix_memalign.c index bd2af6f55ff..2dd64bf5aca 100644 --- a/tests/lib/libc/stdlib/t_posix_memalign.c +++ b/tests/lib/libc/stdlib/t_posix_memalign.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $ */ +/* $NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_posix_memalign.c,v 1.6 2023/07/04 15:06:36 riastradh Exp $"); +__RCSID("$NetBSD: t_posix_memalign.c,v 1.7 2023/07/05 11:43:05 riastradh Exp $"); #include <atf-c.h> @@ -152,20 +152,19 @@ ATF_TC_BODY(aligned_alloc_basic, tc) void *const p = aligned_alloc(align[i], size[j]); /* - * C11, 6.2.8 Alignment of objects, paragraph - * 4, p. 48: + * C17, 6.2.8 Alignment of objects, paragraph + * 4, p. 37: * * Every valid alignment value shall be a * nonnegative integral power of two. * - * C11, 7.22.3.1 The aligned_alloc function, + * C17, 7.22.3.1 The aligned_alloc function, * paragraph 2, p. 348: * - * The value of alignment shall be a valid - * alignment supported by the - * implementation and the value of size - * shall be an integral multiple of - * alignment. + * If the value of alignment is not a + * valid alignment supported by the + * implementation the function shall fail + * by returning a null pointer. * * Setting errno to EINVAL is a NetBSD * extension. The last clause appears to rule @@ -173,8 +172,7 @@ ATF_TC_BODY(aligned_alloc_basic, tc) * not clear. */ if (align[i] == 0 || - (align[i] & (align[i] - 1)) != 0 || - (size[j] != 0 && size[j] % align[i] != 0)) { + (align[i] & (align[i] - 1)) != 0) { if (p != NULL) { ATF_CHECK_EQ_MSG(p, NULL, "aligned_alloc(%zu, %zu): %p", |
