From mboxrd@z Thu Jan 1 00:00:00 1970 From: ben.hutchings@roundpoint.com To: gcc-gnats@gcc.gnu.org Subject: libstdc++/4503: __enc_traits destructor crashes if initialisation failed Date: Mon, 08 Oct 2001 08:56:00 -0000 Message-id: <20011008154712.27316.qmail@sourceware.cygnus.com> X-SW-Source: 2001-10/msg00151.html List-Id: >Number: 4503 >Category: libstdc++ >Synopsis: __enc_traits destructor crashes if initialisation failed >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Oct 08 08:56:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: ben.hutchings@roundpoint.com >Release: gcc-3.0.1 >Organization: >Environment: Solaris 8 on SPARC >Description: __enc_traits::~__enc_traits() calls iconv_close() on each of its iconv_t members. On Solaris, iconv_close crashes if given the error value (iconv_t)(-1), rather than doing nothing (as one might expect). I'm unclear on what public functions utilise__enc_traits. The test programs 22_locale/codecvt_unicode_*.cc use it directly and crash on Solaris (after I apply kluges so that _GLIBCPP_USE_WCHAR_T is defined), so I've written a trivial test case based on that. >How-To-Repeat: Compile and run the attached file test.cc >Fix: Make each iconv_close call conditional on the descriptor not being equal to (iconv_t)(-1). >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.cc" I2luY2x1ZGUgPGxvY2FsZT4KaW50IG1haW4oKQp7CiAgICBzdGQ6Ol9fZW5jX3RyYWl0cyB0cmFp dHMoImZvbyIsImJhciIpOyAvLyBub24tZXhpc3RlbnQgZW5jb2RpbmdzCiAgICB0cmFpdHMuX01f aW5pdCgpOwp9Cg==