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: [email protected]
ReportedBy: [email protected]
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...)