This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/54954] New: malloc optimizations not disabled by -fno-builtin
- From: "swalter at lexmark dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 17 Oct 2012 16:09:57 +0000
- Subject: [Bug c/54954] New: malloc optimizations not disabled by -fno-builtin
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54954
Bug #: 54954
Summary: malloc optimizations not disabled by -fno-builtin
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: swalter@lexmark.com
Consider the code:
static int foo;
void bar ()
{
foo = 0;
malloc();
assert(foo);
}
foo is not reloaded after the call to malloc, even when -fno-builtin is thrown.
This is incorrect behavior because malloc() could call back into the current
module, where foo is modified. A full example is attached.
(Assume that malloc calls increment_count() if I can't get a second file to
attach...)