Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 39004 invoked from network); 17 Oct 2007 18:17:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2007 18:17:29 -0000 Received: (qmail 20238 invoked by uid 500); 17 Oct 2007 18:17:17 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 20223 invoked by uid 500); 17 Oct 2007 18:17:17 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 20212 invoked by uid 99); 17 Oct 2007 18:17:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 11:17:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 18:17:20 +0000 Received: from qxvcexch01.ad.quovadx.com ([192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.6) with ESMTP id l9HIEVmo025952 for ; Wed, 17 Oct 2007 18:14:31 GMT Received: from [10.70.3.143] ([10.70.3.143]) by qxvcexch01.ad.quovadx.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 17 Oct 2007 12:13:14 -0600 Message-ID: <47165111.4000408@roguewave.com> Date: Wed, 17 Oct 2007 12:14:41 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: stdcxx 4.2.0/4.1.3 binary incompatibility on Linux References: <471644A7.9050101@roguewave.com> <47164C7F.5050106@roguewave.com> In-Reply-To: <47164C7F.5050106@roguewave.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Oct 2007 18:13:14.0739 (UTC) FILETIME=[62949C30:01C810E9] X-Virus-Checked: Checked by ClamAV on apache.org Martin Sebor wrote: > Martin Sebor wrote: >> In a 12D build with the default gcc 4.1.0 on SuSE Linux Enterprise >> Server 10 (x86_64), the following simple program abends with the >> error below after upgrading the 4.1.3 library to 4.2.0: > > I've enhanced the program to replace operators new and delete > and to print the value of the pointer. The enhanced test case > and the output obtained from a 12D build with gcc 3.4.6 on Red > Hat Enterprise Linux AS release 4 (Nahant Update 4) is below. > Interestingly, the 12d (32-bit) output with Sun C++ on Solaris > is fine. I think finally I might be getting somewhere with this. The 32 bit library seems to work fine on Linux, too (the test case and all examples run to completion). On Solaris, both 12d (32-bit) and 12D (64-bit) are good. So it looks like the problem is isolated to 64-bit Linux (of course, we haven't checked AIX or HP-UX). > $ cat t.cpp && LD_LIBRARY_PATH=../lib ./t > #include > #include > #include > #include > > int main () > { > std::string s = "a"; > } > > void* operator new (std::size_t n) throw (std::bad_alloc) > { > void* const p = std::malloc (n); > std::fprintf (stdout, "operator new (%zu) ==> %#p\n", n, p); > return p; > } > > void operator delete (void *p) throw () > { > std::fprintf (stdout, "operator delete (%#p)\n", p); > std::free (p); > } > > void* operator new[] (std::size_t n) throw (std::bad_alloc) > { > void* const p = std::malloc (n); > std::fprintf (stdout, "operator new[] (%zu) ==> %#p\n", n, p); > return p; > } > > void operator delete[] (void *p) throw () > { > std::fprintf (stdout, "operator delete[] (%#p)\n", p); > std::free (p); > } > > operator new (58) ==> 0x502010 > operator delete (0x501fe8) > *** glibc detected *** free(): invalid pointer: 0x0000000000501fe8 *** > Aborted > > >> >> #include >> >> int main () >> { >> std::string s = "a"; >> } >> >> The only library symbols referenced from the executable are >> >> __rw::__rw_throw(int, ...) >> __rw::__rw_deallocate(void*, unsigned long, int) >> std::string::_C_null_ref >> std::string::string(char const*, std::allocator const&) >> >> Of these, the first one isn't being called and the second and >> fourth haven't changed (according to diff of string.cc). I hate >> to admit I'm stumped. I suppose I should try to do a build on >> a different distribution of Linux with an older version of gcc >> to see if I can reproduce it there. >> >> >> *** glibc detected *** ./t: free(): invalid pointer: >> 0x0000000000500fe8 *** >> ======= Backtrace: ========= >> /lib64/libc.so.6[0x2b71c3a4537e] >> /lib64/libc.so.6(__libc_free+0x6c)[0x2b71c3a4699c] >> ./t(__gxx_personality_v0+0x198)[0x400968] >> /lib64/libc.so.6(__libc_start_main+0xf4)[0x2b71c39f7154] >> ./t(__gxx_personality_v0+0x59)[0x400829] >