public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52734] New: Incorrect optimization of uClibc sbrk()
@ 2012-03-27  5:32 michael at talamasca dot ocis.net
  2012-03-27  7:43 ` [Bug c/52734] " rguenth at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: michael at talamasca dot ocis.net @ 2012-03-27  5:32 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-02-16 13:16 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27  5:32 [Bug c/52734] New: Incorrect optimization of uClibc sbrk() michael at talamasca dot ocis.net
2012-03-27  7:43 ` [Bug c/52734] " rguenth at gcc dot gnu.org
2012-03-27  7:44 ` mikpe at it dot uu.se
2012-03-27  7:54 ` mikpe at it dot uu.se
2012-03-27  7:57 ` mikpe at it dot uu.se
2012-03-27  8:01 ` michael at talamasca dot ocis.net
2012-03-27  8:10 ` michael at talamasca dot ocis.net
2012-03-27  8:38 ` [Bug rtl-optimization/52734] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-03-27  9:39 ` [Bug tree-optimization/52734] " rguenth at gcc dot gnu.org
2012-03-27 13:08 ` vries at gcc dot gnu.org
2012-03-27 13:29 ` vries at gcc dot gnu.org
2012-03-27 17:10 ` vries at gcc dot gnu.org
2012-04-10 22:42 ` joerg.jungermann at gmx dot de
2012-04-10 22:58 ` sedat.dilek at gmail dot com
2012-04-11 10:13 ` rguenth at gcc dot gnu.org
2012-04-12 16:26 ` vries at gcc dot gnu.org
2012-04-13 13:19 ` rguenth at gcc dot gnu.org
2012-04-13 19:33 ` vries at gcc dot gnu.org
2012-04-13 19:39 ` sedat.dilek at gmail dot com
2014-02-16 13:16 ` jackie.rosen at hushmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).