This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/32771] New: Fixincludes should fix realloc in <stdlib.h> in glibc
- From: "hjl at lucon dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2007 22:30:36 -0000
- Subject: [Bug other/32771] New: Fixincludes should fix realloc in <stdlib.h> in glibc
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In <stdlib.h> from glibc, 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.
fixincludes should remove __attribute_malloc__ from realloc.
--
Summary: Fixincludes should fix realloc in <stdlib.h> in glibc
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl at lucon dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32771