This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/4792] New: realloc is marked as __attribute_malloc__
- From: "hjl at lucon dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 15 Jul 2007 22:28:02 -0000
- Subject: [Bug libc/4792] New: realloc is marked as __attribute_malloc__
- Reply-to: sourceware-bugzilla at sourceware dot org
In <stdlib.h>, there are
/* Re-allocate the previously allocated block
in PTR, making the new block SIZE bytes long. */
extern void *realloc (void *__ptr, size_t __size)
__THROW __attribute_malloc__ __attribute_warn_unused_result__;
However, when a function is marked as mallloc-like, gcc assumes it will
return an address which can alias something else. In case like
#include <stdlib.h>
int *p;
p = malloc (4);
*p = 0;
p = realloc (p, 4);
*p = 1;
will have VOPs that do not prevent re-ordering of the two stores.
--
Summary: realloc is marked as __attribute_malloc__
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: hjl at lucon dot org
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=4792
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.