Just FYI: The Freetz project had success with a backport of the tentative patch attached to GCC bug #52734 on MIPS.
- Sedat - [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52734 On Tue, Mar 27, 2012 at 7:25 AM, Michael Deutschmann <[email protected]> wrote: > Thought I should give you guys a warning. GCC 4.7.0 miscompiles uClibc > 0.9.33 really badly; almost every significant program segfaults quickly. > I've traced down the problem and it is definitely a GCC bug; the uClibc > source isn't doing anything wrong. > > The problem rests in sbrk(). GCC misoptimizes: >> oldbrk = __curbrk; >> if (brk (oldbrk + increment) < 0) >> return (void *) -1; >> return oldbrk; > > into: >> if (brk (__curbrk + increment) < 0) >> return (void *) -1; >> return __curbrk; > > Since brk() alters __curbrk, the result is a dysfunctional malloc > subsystem. > > Adding a volatile tag to __curbrk (remember to make it "void * > volatile", not "volatile void *") supresses the problem. Although it > does make me nervous to have an optimizer problem this bad in my > compiler... > > I've checked, and none of the magical things uClibc does > with __attribute__ are necessary for the bug to appear. I've reported a > simplified case to GCC's bug tracker as #52734. > > ---- Michael Deutschmann <[email protected]> > _______________________________________________ > uClibc mailing list > [email protected] > http://lists.busybox.net/mailman/listinfo/uclibc _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
