From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15379 invoked by alias); 26 Jan 2015 15:02:48 -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 14741 invoked by uid 55); 26 Jan 2015 15:02:32 -0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64798] [5 regression] g++.old-deja/g++.eh/badalloc1.C FAILs Date: Mon, 26 Jan 2015 15: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: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 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-01/txt/msg02895.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64798 --- Comment #2 from rguenther at suse dot de --- On Mon, 26 Jan 2015, Richard Biener wrote: > On Mon, 26 Jan 2015, ro at gcc dot gnu.org wrote: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64798 > > > > Bug ID: 64798 > > Summary: [5 regression] g++.old-deja/g++.eh/badalloc1.C FAILs > > Product: gcc > > Version: 5.0 > > Status: UNCONFIRMED > > Severity: normal > > Priority: P3 > > Component: libstdc++ > > Assignee: unassigned at gcc dot gnu.org > > Reporter: ro at gcc dot gnu.org > > CC: rguenth at gcc dot gnu.org > > Host: sparc*-sun-solaris2.* > > Target: sparc*-sun-solaris2.* > > Build: sparc*-sun-solaris2.* > > > > Between 20150116 (r219745) and 20150123 (r220039), > > g++.old-deja/g++.eh/badalloc1.C > > started to FAIL on 32-bit Solaris/SPARC: > > > > FAIL: g++.old-deja/g++.eh/badalloc1.C -std=c++11 execution test > > FAIL: g++.old-deja/g++.eh/badalloc1.C -std=c++14 execution test > > FAIL: g++.old-deja/g++.eh/badalloc1.C -std=c++98 execution test > > > > Program received signal SIGSEGV, Segmentation fault. > > [Switching to Thread 1 (LWP 1)] > > __cxxabiv1::__cxa_throw (obj=0x2195c , > > tinfo=0x73908 , dest=0x0) > > at /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/eh_throw.cc:76 > > 76 > > __GXX_INIT_PRIMARY_EXCEPTION_CLASS(header->exc.unwindHeader.exception_class); > > 1: x/i $pc > > => 0xff220314 <__cxxabiv1::__cxa_throw(void*, std::type_info*, void > > (*)(void*))+96>: sttw %g2, [ %i0 + -24 ] > > (gdb) where > > #0 __cxxabiv1::__cxa_throw (obj=0x2195c , > > tinfo=0x73908 , dest=0x0) > > at /vol/gcc/src/hg/trunk/local/libstdc++-v3/libsupc++/eh_throw.cc:76 > > #1 0x00011114 in fn_throw () > > at > > /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C:98 > > #2 0x000112f8 in main () > > at > > /vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C:129 > > (gdb) p $i0-24 > > $3 = 137540 > > > > The SEGV happens because the sttw target needs to be 8-byte aligned, but is > > not. > > Does malloc return 8-byte aligned memory? Is __alignof__ > > struct free_entry { > std::size_t size; > free_entry *next; > }; > > less than 8? Ah - the issue might be that g++.old-deja/g++.eh/badalloc1.C does extern "C" void *malloc (size_t size) { object *p = reinterpret_cast(&arena[pos]); if (fail) return 0; p->size = size; size = (size + __alignof__(object) - 1) & - __alignof__(object); pos += size + sizeof(object); thus it aligns to 'object' but 'object' is struct object { size_t size __attribute__((aligned)); }; Richard