From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 712193858C53; Tue, 28 Mar 2023 14:54:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 712193858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680015281; bh=TZjDnmkZklMEAc1wGV5fg1s71kczDDUrxIDd5ddl0H0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CJWPrOneIANBDDT5fZrzSgKigksV6AArs3fyFJeRu58uoyFYLf4qzgMQi0plexB+v r67Ybq5WxMqeweNdswnymkGhUpf6UsClWVhMPg2Er7Jxu5rwCpjwe9AJVF935gO0yR 4Gn8dpKtLhZmCaTiNclvtmznzN4L40qMeJCYubN4= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103387] powerpc64le: segmentation fault on std::cout with ieee128 long double variable Date: Tue, 28 Mar 2023 14:54:40 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103387 --- Comment #7 from Jonathan Wakely --- OK, I see what's happening now: Breakpoint 3.3, std::__gnu_cxx_ldbl128::num_put > >::num_put ( this=3D0x101c1f98 <(anonymous namespace)::num_put_c>, __refs=3D1) at /home/test/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/lo= cale_facets.h:2339 2339 num_put(size_t __refs =3D 0) : facet(__refs) { } (gdb) p this $9 =3D (std::__gnu_cxx_ldbl128::num_put > > * const) 0x101c1f98 <(anonymous namespace)::num_put_c> (gdb) cont Continuing. Breakpoint 3.4, std::__gnu_cxx_ldbl128::num_put > >::num_put ( this=3D0x101c25f8 <(anonymous namespace)::num_put_w>, __refs=3D1) at /home/test/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/lo= cale_facets.h:2339 2339 num_put(size_t __refs =3D 0) : facet(__refs) { } (gdb) p this $10 =3D (std::__gnu_cxx_ldbl128::num_put > > * const) 0x101c25f8 <(anonymous namespace)::num_put_w> (gdb) cont Continuing. Breakpoint 3.1, std::__gnu_cxx_ieee128::num_put > >::num_put ( this=3D0x101c06b8 , __refs=3D1) at /home/test/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/lo= cale_facets.h:2339 2339 num_put(size_t __refs =3D 0) : facet(__refs) { } (gdb) p this $11 =3D (std::__gnu_cxx_ieee128::num_put > > * const) 0x101c06b8 (gdb) cont Continuing. Breakpoint 3.2, std::__gnu_cxx_ieee128::num_put > >::num_put ( this=3D0x101c06f8 , __refs=3D1) at /home/test/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/lo= cale_facets.h:2339 2339 num_put(size_t __refs =3D 0) : facet(__refs) { } (gdb) p this $12 =3D (std::__gnu_cxx_ieee128::num_put > > * const) 0x101c06f8 (gdb) cont Continuing. Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) up #1 0x0000000010015640 in std::__gnu_cxx_ieee128::num_put > >::put ( this=3D0x101c1f98 <(anonymous namespace)::num_put_c>, __s=3D..., __io= =3D..., __fill=3D32 ' ', __v=3D0.100000000000000000000000000000000005) at /home/test/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/lo= cale_facets.h:2468 2468 { return this->do_put(__s, __io, __fill, __v); } (gdb) p this $13 =3D (const std::__gnu_cxx_ieee128::num_put > > * const) 0x101c1f= 98 <(anonymous namespace)::num_put_c> The facet used for the output is __gnu_cxx_ieee128::num_put but it has the address of $9 which is a __gnu_cxx_ldbl128::num_put. So the wrong pointer is being returned when accessing the facet.=