Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.COLUMBIA.EDU!dupuy From: dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) Newsgroups: gnu.g++.bug Subject: Why some G++ programs failed on the Sun-3, but worked on the Sun-4 Message-ID: <8904241855.AA17311@cs.columbia.edu> Date: 24 Apr 89 18:55:40 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: dupuy@cs.columbia.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 24 GNU G++ 1.34.1 / SunOS 4.0.1 / Sun-3 (& not Sun-4) They were all dying in malloc, the first time it was called (by on_exit, in the G++ startup code). When linked with Sun's debugging malloc, a diagnostic was given about "free: illegal address (0x21af2)". The problem was that the value returned by sbrk was not fullword aligned, and this tickled a bug in Sun's malloc implementation, which uses free to add newly sbrk'd space to the free-"list". I'm amazed this hasn't bit anyone before. The bug wasn't tickled on the Sun-4, since on the sparc, ld++ fullword aligns common blocks (and thus the end of bss and beginning of sbrk'd space). The right fix is to eliminate the bug in morecore, which (having source) I have done. But it is probably desirable to fullword align comon blocks on all architectures (for performance reasons), and since this is apparently the behavior of the Sun linker, it would be useful for GNU ld and ld++ to do this on Suns. @alex -- inet: dupuy@cs.columbia.edu uucp: ...!rutgers!cs.columbia.edu!dupuy