From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128276 invoked by alias); 9 Oct 2015 12:02:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 128133 invoked by uid 48); 9 Oct 2015 12:02:39 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/67903] std::locale compatibility between gcc4.9 and gcc5.1 Date: Fri, 09 Oct 2015 12:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg00647.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67903 --- Comment #2 from Jonathan Wakely --- (In reply to Yucheng Low from comment #0) > This would not be a problem if not for the fact that: > - the global locale is initialized with an inplace new: > locale_init.cc:378 > _M_facets = new (&facet_vec) const facet*[_M_facets_size]; > _M_caches = new (&cache_vec) const facet*[_M_facets_size]; > - the locale inserter (locale_init.cc:354) correctly checks when it > should > extend the _M_facets, but happily just deletes the old array. > locale.cc:348 > delete [] __oldf; > delete [] __oldc; > - which of course fails gloriously with the inplace new. > > - The solution is to actually do the resize correctly and check when we > do not actually need to delete. A better check might be to compare the pointers with the buffers used for the placement new.