about summary refs log tree commit diff
path: root/malloc/tst-realloc.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2024-01-011-1/+1
|
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-061-1/+1
|
* realloc: Return unchanged if request is within usable sizeSiddhesh Poyarekar2022-12-081-0/+23
| | | | | | | | | | | | | | | | | If there is enough space in the chunk to satisfy the new size, return the old pointer as is, thus avoiding any locks or reallocations. The only real place this has a benefit is in large chunks that tend to get satisfied with mmap, since there is a large enough spare size (up to a page) for it to matter. For allocations on heap, the extra size is typically barely a few bytes (up to 15) and it's unlikely that it would make much difference in performance. Also added a smoke test to ensure that the old pointer is returned unchanged if the new size to realloc is within usable size of the old pointer. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: DJ Delorie <dj@redhat.com>
* malloc: Exit early on test failure in tst-reallocFlorian Weimer2022-03-101-31/+15
| | | | | | | | | | This addresses more (correct) use-after-free warnings reported by GCC 12 on some targets. Fixes commit c094c232eb3246154265bb035182f92fe1b17ab8 ("Avoid -Wuse-after-free in tests [BZ #26779]."). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Avoid -Wuse-after-free in tests [BZ #26779].Martin Sebor2022-01-261-0/+8
| | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* tst-realloc: do not check for errno on success [BZ #22611]Aurelien Jarno2017-12-291-4/+0
| | | | | | | | | | | POSIX explicitly says that applications should check errno only after failure, so the errno value can be clobbered on success as long as it is not set to zero. Changelog: [BZ #22611] * malloc/tst-realloc.c (do_test): Remove the test checking that errno is unchanged on success.
* Split DIAG_* macros to new header libc-diag.h.Zack Weinberg2017-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quite a few tests include libc-internal.h just for the DIAG_* macros. Split those macros to their own file, which can be included safely in _ISOMAC mode. I also moved ignore_value, since it seems logically related, even though I didn't notice any tests needing it. Also add -Wnonnull suppressions to two tests that _should_ have them, but the error is masked when compiling against internal headers. * include/libc-diag.h: New file. Define ignore_value, DIAG_PUSH_NEEDS_COMMENT, DIAG_POP_NEEDS_COMMENT, DIAG_IGNORE_NEEDS_COMMENT, and DIAG_IGNORE_Os_NEEDS_COMMENT here. * include/libc-internal.h: Definitions of above macros moved from here. Include libc-diag.h. Add copyright notice. * malloc/tst-malloc.c, malloc/tst-memcheck.c, malloc/tst-realloc.c * misc/tst-error1.c, posix/tst-dir.c, stdio-common/bug21.c * stdio-common/scanf14.c, stdio-common/scanf4.c, stdio-common/scanf7.c * stdio-common/test-vfprintf.c, stdio-common/tst-printf.c * stdio-common/tst-printfsz.c, stdio-common/tst-sprintf.c * stdio-common/tst-unlockedio.c, stdio-common/tstdiomisc.c * stdlib/bug-getcontext.c, string/tester.c, string/tst-endian.c * time/tst-strptime2.c, wcsmbs/tst-wcstof.c: Include libc-diag.h instead of libc-internal.h. * stdlib/tst-environ.c: Include libc-diag.h. Suppress -Wnonnull for call to unsetenv (NULL). * nptl/tst-mutex1.c: Include libc-diag.h. Suppress -Wnonnull for call to pthread_mutexattr_destroy (NULL).
* Fix malloc/ tests for GCC 7 -Walloc-size-larger-than=.Joseph Myers2017-01-041-0/+15
| | | | | | | | | | | | | | | | | | | | | 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.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Reformat malloc to gnu style.Ondřej Bílka2014-01-021-6/+6
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* malloc: Add realloc test.Will Newton2013-09-091-0/+146
The current tests don't test the functionality of realloc in detail. Add a new test for realloc that exercises some of the corner cases that are not otherwise tested. ChangeLog: 2013-09-09 Will Newton <will.newton@linaro.org> * malloc/Makefile: Add tst-realloc to tests. * malloc/tst-realloc.c: New file.