This is the mail archive of the
mailing list for the glibc project.
Re: [RFC][PATCH v2] Add reallocarray function.
- From: Andreas Schwab <schwab at suse dot de>
- To: Rich Felker <dalias at libc dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, RÃdiger Sonderfeld <ruediger at c-plusplus dot de>, Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha at sourceware dot org
- Date: Tue, 20 May 2014 10:17:04 +0200
- Subject: Re: [RFC][PATCH v2] Add reallocarray function.
- Authentication-results: sourceware.org; auth=none
- References: <5379208F dot 8030000 at cs dot ucla dot edu> <2080621 dot 6fAB4UMNoY at descartes> <Pine dot LNX dot 4 dot 64 dot 1405191501120 dot 25418 at digraph dot polyomino dot org dot uk> <20140520020108 dot GV507 at brightrain dot aerifal dot cx>
Rich Felker <firstname.lastname@example.org> writes:
> Not really related to this patch, but I think the comment about
> __attribute_malloc__ that was copied from realloc is wrong. The new
> and old pointers cannot alias because, if realloc succeeds (and I
> would expect reallocarray to behave the same) the _value_ of the old
> pointer is indeterminate and accessing it (e.g. comparing it with new)
> invokes undefined behavior.
Please report that as a gcc bug (it doesn't mark it either).
Andreas Schwab, SUSE Labs, email@example.com
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."