[Bug c/54954] New: malloc optimizations not disabled by -fno-builtin

swalter at lexmark dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 17 16:10:00 GMT 2012


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...)



More information about the Gcc-bugs mailing list