This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]