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/52734] New: Incorrect optimization of uClibc sbrk()


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52734

             Bug #: 52734
           Summary: Incorrect optimization of uClibc sbrk()
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: michael@talamasca.ocis.net
              Host: i386-pc-linux-gnu
            Target: i386-pc-linux-gnu
             Build: i386-pc-linux-gnu


Created attachment 27005
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27005
Simplified code analogous to the sbrk problem

GCC 4.7.0 miscompiles uClibc 0.9.33 producing an unusable library.  The problem
is in uClibc's sbrk() implementation -- GCC optimizes away sbrk's attempt to
save a global variable before a called function changes it.  Basically, that
function (brk) is wrongly treated as an __attribute__((pure)) function.

The above text is to help anyone searching for the bug.  I'm attaching a
distilled case showing the same problem.  The function ccc() is supposed to
return the value of bbb before the second call to aaa(), but when compiled with
-Os it returns the value of bbb afterwards.

This is on i386-pc-linux-uclibc.  GCC 4.6.3 did not have the problem.


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